Puppy dynamic menu structure Project

Under development: PCMCIA, wireless, etc.
Message
Author
User avatar
rarsa
Posts: 3053
Joined: Sun 29 May 2005, 20:30
Location: Kitchener, Ontario, Canada
Contact:

Puppy dynamic menu structure Project

#1 Post by rarsa »

NOTE: DON'T USE THIS THREAD TO ASK QUESTIONS ABOUT THE MENU, THIS ONE IS FOR COORDINATION DURING THIS PROJECT. Thank you for understanding.

The goal of this project is the following:
- Create a standard menu structure that will facilitate adding and modifying menu entires in all the supported window managers.

Here is the highest level work plan

Version | Included
0.1.0 ---- Convert the jwm menu to an xfce4 menu.xml file
Done!
This task set the foundation for the xml transformation from one structure to another.
0.2.0 ---- Show the correct icons
Done!
I found the right folder to put the mini-icons so they show in the menu.
0.3.0 ---- Generate the XDG structure and menu file
In progress.
I've studied the XDG specification and the actual xfce implementation of the spec.
I'm working on converting the oficial jwm menu to the XDG file structure.
0.4.0 Generate the jwm menu from the XDG structure
Here I'm thinking on studying the xfce menu generation code as they have successfully translating the xdg structure into a menu.
0.5.0 Generate the <next wm> menus from the XDG structure
This will be built on the learnings of the 0.4.0. Once we can interpret the XDG structure, it will be quite simple to generate the specific menus.
We will just need to understand how each of the WM can make use of the XDG structure.


The toolset to use will be very simple C + libxml.

Why? I'm no C fan but in this case it seems the most fit tool for the task.


If there are other people wanting to help here it will be great.

Helping could be in the way of Testing, Ideas, documentation, coding and cheering.

As for coding:
If you are a novice coding this could be your oportunity to learn doing something useful.
If you are an expert, you can help speedup the implementation along with performing code walkthroughs and recomendations for the novice developers.

Also if you can help me moving the code to a public CSV tree that would be very usefull.

So, don't be affraid. If after enrroling you think it's beyond your time avaliability or capabilities, that's OK. Or if you find it's not challenging enough, that's ok too.

User avatar
MU
Posts: 13649
Joined: Wed 24 Aug 2005, 16:52
Location: Karlsruhe, Germany
Contact:

#2 Post by MU »

very good approach, rarsa.

I made a backupscript for the "Dotpups"-menues in Puppy 1.0.5 (jwm, Fvwm95, icewm), but Barry found Bugs, so it did not went in the release.

It was somewhat "unclean", as I had to extract/restore the "Dotpups" -menue-entries from each of the 3 WM before/after remastering a CD.
I did that in sh and Basic (I took sh-code from Dotpup-wizard, and started porting it to PuppyBasic afterwards, but that step was not finished yet).

With a single XML-File, things would be easier and there would be less danger of Bugs I think.

Mark

User avatar
rarsa
Posts: 3053
Joined: Sun 29 May 2005, 20:30
Location: Kitchener, Ontario, Canada
Contact:

#3 Post by rarsa »

Actually the XDG standard is not too difficult. The devil is in the particular implementation details.

Here's an overview if what I know:

The concept is very simple.

One <application>.desktop file per application in a flat directory
One <directory>.directory file per menu group.
One <menu file> that defines the menu structure

The menu creation is non-deterministic from the point of view of the <menu file> as it bases the menu entries on the 'categories' specified in each of the <application>.desktop files.

It was a challenge to find information of where this files should be as it is different between WM (Gnome, KDE, Icewm, xfce, etc). My conclussion is the following (although different WM may have other alternate locations on top of these ones):

Application destop files: /usr/share/applications
Directory files : /usr/share/desktop-directories
Menu file : This one is 100% WM specific and we will have to find where it is for each WM.
- Xfce4 it is /etc/xdg/menus/xfce4.menu
- IceWM has the capability (through menuprog) to define a program that will generate the menu.
- I will need help researching the other WM (Jwm, fvwm95, flubox, etc).

On top of that, each WM may define it's own menu structure, where just a portion of it depends on the XDG standard:

- Xfce has /etc/xdg/xfce4/desktop/menu.xml
- IceWM has /etc/icewm/menu
- etc.

If that wasn't enough, all the above may have user overrides on the home folder.

Of course, with puppy we don't have to use all the flexibility/complexity of the XDG standard. We can keep it quite simple.

The great advantage of XDG is that adding an entry to the menu is as easy as creating an <application>.desktop file. No need to modify menu files. The WMs that support XDG refresh the menu ever time they show it.

What's more. This approach respects user's customizations. If they reorganize the menu, new applications will still find a place if there is a place holder for its category. Of course if a user does not want to see a category, it won't be shown.

I will add to this post as I lean more.

===== Change log ====
Oct 15, 2005
- Created initial document
Last edited by rarsa on Sun 16 Oct 2005, 05:10, edited 1 time in total.

User avatar
rarsa
Posts: 3053
Joined: Sun 29 May 2005, 20:30
Location: Kitchener, Ontario, Canada
Contact:

#4 Post by rarsa »

First task I need help with is:

Review the xfce source code (or ask around the xfce forum) and find where the menu is dynamically created.

I hope it's inside a library that we can reuse. In any event, I'm expecting to use whatever code they have :twisted:

I've completed this task my self, there were no volunteers
Last edited by rarsa on Sat 22 Oct 2005, 23:19, edited 1 time in total.

User avatar
ozboomer
Posts: 135
Joined: Wed 04 May 2005, 21:22
Location: Melbourne, Australia

#5 Post by ozboomer »

All I would suggest at this early(-ish) stage is *please* ensure you use environment variables for how the window manager specific file locations, 'magic numbers', etc are specified. Then, all the startup files, profiles, etc will not have to be re-edited when new WMs are added to the supported list. A file like /etc/wm would contain the current window manager, something runs at startup that hits that file and defines all the env. vars and nothing has to be 'fixed' manually by the user. The first time a WM is selected (or if the system detects ANY of the WM definition files have changed), the system should automatically rebuild the relevant WM menu file... A FluxBox menu file, for example, shouldn't have to be rebuilt every boot or X-restart unless the XDG file has changed (comparing dates on FB menu file against XDG file date).

It would probably be a good idea to also have the menu thing in its own /root/.pmenurc or something file, so that the menu system will still work the next time .xinitrc/.profile/.bashrc is trashed by the next puppy upgrade. It's important that the menu still works and looks how users expect it to after an upgrade.

Has there been any thought given to how user can add their own items to the menu... and how will the Puppy menu system/conversions will react to that?

Perhaps the first posting in this thread could provide a link to the relevant discussion thread in the 'main' part of the forums so comments, etc. such as these could all be placed in the same location - there's currently too much *stuff* and too little structure in the forums to be able to track the 'correct' place for these comments.

User avatar
rarsa
Posts: 3053
Joined: Sun 29 May 2005, 20:30
Location: Kitchener, Ontario, Canada
Contact:

#6 Post by rarsa »

ozboomer wrote:The first time a WM is selected (or if the system detects ANY of the WM definition files have changed), the system should automatically rebuild the relevant WM menu file
Thank you for your comments ozoboomer. There are a few missconceptions in your post, I hope this posts clarifies them. The solution will be even nicer than I expected.

a) At first we are building the XDG structure. It is the window manager responsibility to build it's menu from there. xfce, icewm, kde, gnome at least, generate the menu every time the menu is shown (Of course it's cached for performance). This behaviour depends on the WM, not on our solution.

b) For Window managers that do not support XDG we will create the menu builder. For this part is where I want to use the xfce code. In this case, most likelly the wm will need to be reset to see changes in the menu.

c) It will be the DotPup's responsibility to add the <application>.desktop file at installation time. This will require cooperation from packagers or volunteers.

d) No user intervention will be necessary to add menu entries to the menu.

e) We will also create (or borrow) a XDG menu editor.

I've seen interest from you to improve the menu handling. Do you want to participate in the project? I'm quite excited as it's comming along quite nice.

User avatar
rarsa
Posts: 3053
Joined: Sun 29 May 2005, 20:30
Location: Kitchener, Ontario, Canada
Contact:

#7 Post by rarsa »

Break Through!

I'm almost ready to release version 0.3.0. (see the work plan on the first post)

I've created a utility to generate the XDG menu structure from the .jwmrc file. My plan is to use this utility when installing the menu handler.

This means that the users will not loose any menu modifications when they start using the new method.

It also means that we will be able to regenerate the structure after installing DotPups that do not install an <application>.desktop. At the begining it will be all of them. I expect that once this is ready and proven, DotPup developers start including the <application>.desktop file in their installs.

The exciting part at this stage is that the xfce loads the new structure automatically.

User avatar
Lobster
Official Crustacean
Posts: 15522
Joined: Wed 04 May 2005, 06:06
Location: Paradox Realm
Contact:

#8 Post by Lobster »

:D

Great idea and work. The more of Puppy (this is a start) that is available as XML the better.

If resources are available with "XML storage format" it makes developers and Barrys job much easier (I believe I am right in that) Better not say any more - just wanted to say well done :)
Puppy Raspup 8.2Final 8)
Puppy Links Page http://www.smokey01.com/bruceb/puppy.html :D

User avatar
rarsa
Posts: 3053
Joined: Sun 29 May 2005, 20:30
Location: Kitchener, Ontario, Canada
Contact:

Stage 0.3.0 completed

#9 Post by rarsa »

As promissed, I found time to continue with the dynamic menu

I've found a workarund for stage 0.2.0 (icons) and completed stage 0.3.0 of my work plan:

Again, the file attached is only for use by the people that want to test it. I've intentionally left some manual steps to prevent accidents.

How to use it:
1. Download the attached file
2. Expand with tar -xvzf jwm2xdg-0.3.0.tar.gz
3. Read the README file. (It's quite short)
4. Rename or backup the following files:
/etc/xdg/menus/xfce4.menu
/root/.config/xfce4/desktop/menu.xml
5. Run the jwm2xdg utility with the following parameters:

Code: Select all

jwm2xdg "/root/.jwmrc" "/etc/xdg/menus/xfce4.menu" "/usr/share/desktop-directories/" "/usr/share/applications/"
(You may avoid typos by copying the command instead of retyping it)
6. Copy the menu.xml file included to /root/.config/xfce4/desktop/menu.xml
7. Restart the window manager.

If you want to add applications to the menu, just create a new desktop file under /usr/share/applications. Use any of the existing files as an example.

The package includes the source code for the utility. Have a look and give me your feedback.

TODO:
- Right now I'm creating the categories based on the puppy menu structure. I need to translate those categories to the registered xdg categories so new applications can be shown in the right submenu.


Known Issues:
- Submenu icons dont show: Workaround. If you want to show the icons in the submenus, create symbolic links to all the mini-icons in the pixmaps folder

Code: Select all

ln -s /usr/local/lib/X11/pixmaps/ /usr/local/lib/X11/mini-icons/*
- Separators are not preserved: For now, no workaround. I've asked in the Xfce forum if the <Layout> tag was suported. When I use it, Xfce interprets it as a malformed XML.


====ChangeLog====
Oct 20, 2005 11:45
- I've fixed the bug that required to end the paths in the directories and application with /

Oct 19, 2005 12:29
- Fixed the README file to add / at the end of the paths.
Attachments
jwm2xdg-0.3.2.tar.gz
(11.2 KiB) Downloaded 705 times
Last edited by rarsa on Fri 21 Oct 2005, 04:23, edited 5 times in total.

User avatar
MU
Posts: 13649
Joined: Wed 24 Aug 2005, 16:52
Location: Karlsruhe, Germany
Contact:

#10 Post by MU »

Rarsa, I ran jwm2xdg ,and it created many entries in /usr/share/applications and /usr/share/desktop-directories.

Looks good so far.
Then I replaced /root/.config/xfce4/desktop/menu.xml with the one provided in your package, and restarted X.
Now Xfce just has 2 Menue-entries: "Help" (submenue with 3 entries) and "Quit to console". Nothing more.

I still have the old xfce4 with my own .xinitrc (rox), not the last rpm.

If someone could confirm if it works with the RPM or not?

If it works, I will try to add that to the Dotpup-Wizard.

Mark

User avatar
bombayrockers
Posts: 427
Joined: Sat 24 Sep 2005, 16:47
Location: Mumbai, India
Contact:

??

#11 Post by bombayrockers »

Rarsa i ran jwm2xdg using exactly the same command as in readme
but the *.desktop were created in /usr/share rather than /usr/share/applications ??. this happened twice

i copied them to /usr/share/applications and copied the menu.xml to /root/.config/xfce4/desktop and the menu was working fine but the menu was not showing any icons stored in /usr/share/pixmap or /usr/share/mini-icons .

User avatar
MU
Posts: 13649
Joined: Wed 24 Aug 2005, 16:52
Location: Karlsruhe, Germany
Contact:

#12 Post by MU »

oh yes, thats it!
I moved the application* to /usr/share/applications,
and the desktop* to /usr/share/desktop-directories.

Now they show up in the xfce-menue.
The only menue, that shows icons, is the Dotpups-Menue.
It uses absolute paths for the icons (generated by Dotpup-Wizard).

Same works with the "personal menue" I exported to JWM with my Menue-Editor ( http://www.murga.org/%7Epuppy/viewtopic.php?t=1985 )

Mark

User avatar
rarsa
Posts: 3053
Joined: Sun 29 May 2005, 20:30
Location: Kitchener, Ontario, Canada
Contact:

#13 Post by rarsa »

bombayrockers wrote:were created in /usr/share rather than /usr/share/applications
Oops, my mistake. The paths must end with the slash /usr/share/desktop-directories/ /usr/share/applications/

I will fix the README file and the post. sorry.

User avatar
rarsa
Posts: 3053
Joined: Sun 29 May 2005, 20:30
Location: Kitchener, Ontario, Canada
Contact:

#14 Post by rarsa »

I've updated the package (0.3.2) to accept paths ending with and without /.

I'm also studying the Xfce menu generation code and I have contacted Joe (from JWM) to advice that we are looking for automatic menu generation based on the xdg menu specification.

So all in all it's good, except for the little time I'm able to put into the project.

The offer to contributors is still standing. This is really a case where three people may do it in half the time.

User avatar
rarsa
Posts: 3053
Joined: Sun 29 May 2005, 20:30
Location: Kitchener, Ontario, Canada
Contact:

#15 Post by rarsa »

Second task I will need help with is the following:

Define the menu structure.

This is a not technical task. Actually it requires someone with very good organization sense.

This task has two steps:
1. Assign freedesktop registered categories to each of the entries included in the standard puppy menu.
2. Define the menu based on those categories

Here is the list of categories:
http://standards.freedesktop.org/menu-s ... t/apa.html

Each menu entry may have more than one category. When the menu is defined, only the entries that match certain categories will be included. eg.

"Mozilla" can be "Network, WebBrowser"
"Top view running process" can be "System"
"PupGet package manager" can be "Settings, PackageManager"
etc...

then the menu can be defined by the categories it includes. eg.

Control Panel (System, System&Settings,DesktopSettings)
etc.

It does not need to match 100% Barry's organization as it would be almost imposible to categorize based on the registered free desktop categories.

I'm sure that after the first review, many things will change.

I can explain the task and the goal in more detail if you need.

I had a first cut just for testing purposes as follows:

I did it at the menu level. What I really need is to do it at the application level.

menuName="Control-Panel" category="System"
menuName="Utilities" category="Utility"
menuName="Calculators" category="Calculator"
menuName="Setup" category="Settings"
menuName="File-managers" category="FileManager"
menuName="Graphic-processing" category="Graphics"
menuName="Word-processing" category="WordProcessor"
menuName="Information-managers" category="Office"
menuName="Network" category="System,Network"
menuName="Internet" category="Network"
menuName="Multimedia" category="AudioVideo"
menuName="Games" category="Game"
menuName="Find" category="???"
menuName="Run" category="TerminalEmulator"


Thank you in advance to the volunteer.

User avatar
rarsa
Posts: 3053
Joined: Sun 29 May 2005, 20:30
Location: Kitchener, Ontario, Canada
Contact:

#16 Post by rarsa »

BIG BREAK THROUGH

It least for me, as it appears I'm just talking to myself ;)

After much study and investigation I've settled for now on using the gnome-menus library.

It does all the parsing of the XDG menu structure according to the freedesktop.org specification.

I've already created a small test program that generates a .jwmrc xml menu segment.

Once you understand the undocumented API it's quite easy to use, so After I clean up the jwm version I will do the IceWM version. (There is already one generator for IceWM but it's based on perl) and the Fvwm95. Xfce already includes a generator.

I still hope I will get a volunteer to define the menu structure. http://www.murga.org/~puppy/viewtopic.php?p=19499#19499

User avatar
BarryK
Puppy Master
Posts: 9392
Joined: Mon 09 May 2005, 09:23
Location: Perth, Western Australia
Contact:

#17 Post by BarryK »

It least for me, as it appears I'm just talking to myself
ha ha, I don't have the time to contribute, for now, but I am reading your thread and following with interest!

User avatar
gliezl
Posts: 322
Joined: Sat 06 Aug 2005, 22:30
Location: Manila

#18 Post by gliezl »

I'm also following this post. It's really interesting. I don't know if can help. I'm just a plain Puppy user. :)
[color=blue][i]"If you have knowledge, let others light their candles in it."
~Margaret Fuller[/i][/color]

User avatar
Lobster
Official Crustacean
Posts: 15522
Joined: Wed 04 May 2005, 06:06
Location: Paradox Realm
Contact:

#19 Post by Lobster »

tsk tsk Rarsa

Many of us are geeks or geek wannabe's. I followed your conversations with dewdrop on getting the Cups printing system working - even though I never use printing and anyways my printer is supported in the standard Puppy.

Our developers are our most fiesty Puppy asset.
Some of just like to watch :) Just so you know 8)
Puppy Raspup 8.2Final 8)
Puppy Links Page http://www.smokey01.com/bruceb/puppy.html :D

User avatar
rarsa
Posts: 3053
Joined: Sun 29 May 2005, 20:30
Location: Kitchener, Ontario, Canada
Contact:

#20 Post by rarsa »

I don't know if can help. I'm just a plain Puppy user.
And that's who my request for volunteers was intended for.

The second task (Defining the Menu structure) is the prime example where a 'plain user' will do a better job than a technical user.

I asked for volunteers (plural) because even in the case that we come up with two different organization structures the XDG standard is up to the task.

We can have alternative menu structures without each application installer knowing the details.

e.g. Barry likes a flat structure (Two levels of menus). I prefer to have my menus highly categorized, no more than 7+-2 entries in each level or I get lost.

Even more. In linux the difference between plain user and contributor is not clear. Every user can be a contributor.

So... Second call for able brains to Design the menu structure...

No coding, compiling or develpment background required.
Just needed:
- A good sense of organization
- Willigness to provide and receive feedback
- Previous exposure/access to other standard menu structures is not required but may be a plus. (e.g. KDE, Gnome, Windows, Mac)

Post Reply