Page 1 of 2

How to edit the xdg menu?

Posted: Mon 26 Mar 2007, 15:19
by gw
Hello,

I would modify the new xdg menu of Puppy 2.14 to mask or create some commands. Previously, that was done simply by editing the /root/.jwmrc file directly, but now this method is not valid any more. I would mask commands of the menu Puppy, such as the commands tkfont, gcombust, agenda, etc… without delete the programs or add in the menu some commands which are not create automatically such as the commands to start programs with wine, etc…. I don’t know if it is possible and how to proceed with the new xdg menu. I noticed in the .jwmrc file the following message : <!-- Important, only edit /etc/xdg/templates/_root_.jwmrc --> but I don’t know how to do it
Many thanks
--
gw

Posted: Mon 26 Mar 2007, 19:15
by HairyWill
you might find some help here.
http://www.murga-linux.com/puppy/viewtopic.php?t=16124

To remove program entries you need to find the relevant *.desktop file and rename it to something like *.desktop.old.
<edit date="28/03">The correct way to remove a menu entry is given by Rarsa in his post further down
Rarsa wrote:1. The "right" way of preventing an entry from showing in the menu is to add a line with "hidden=true" to the corresponding .desktop file
</edit>
Run the command fixmenus from the prompt and then do menu - shutdown - restart JWM.

Posted: Mon 26 Mar 2007, 20:04
by bostonvaulter
hey,

do you guys know if there is a way to modify the menus for one window manager, but not others?

I also must say that it is rather difficult to modify the xdg menus currently, i wonder if there is a way to make it easier, maybe a simple menu editor program or something.

Posted: Mon 26 Mar 2007, 20:59
by Dougal
Editing the xdg menu will be a real pain -- you need to change the templates in /etc/xdg/templates and Barry has made a whole mess of it, so it's not easy to understand...


Concerning modifying only one menu, in /etc/xdg/menus there are different files that create the different menus, so you just change the relevant one (though if you want to change the templates, you'll have to create copies of them and use those for that WM).

use the old .jwmrc

Posted: Mon 26 Mar 2007, 23:27
by raffy
I myself have not tried to change the xdg menus yet - if I remember right, the change to xdg is meant to make changes in menus work across WManagers.

But for the many who are simply content with JWM, could they have an option to use the tried-and-easy /root/.jwmrc ?

Thanks in advance.

Posted: Tue 27 Mar 2007, 00:03
by alienjeff
I too am less than delighted with the XDG menu system, though I certainly can appreciate its benefits.

However, XDG is the only thing that is keeping me from spending more time with v1.09CE and a contributing factor in complete avoidance of the new XDG 2.xx versions.

So I'm pleasantly using either Puppy v0.9.7 or v1.08r1 or v2.11, thank you very much! Should I want to change the menu structure, it's a comparatively easy task and I don't have to worry about changes affecting or not carrying over to another window manager.

And Raffy: take a look at /root/.jwmrc in v2.14 and you'll see what we mean.

I'll grant you, JWM isn't the prettiest, but it's lean, fast, and easily configurable, providing it isn't under the XDG umbrella.

Posted: Tue 27 Mar 2007, 00:25
by Kal
Here is where I have gotten most of my information on xdg.

http://standards.freedesktop.org/menu-spec/0.8/

Good Luck, Kal

Posted: Tue 27 Mar 2007, 01:05
by GuestToo
you could work around XDG menus by putting a line like this in /etc/profile, just before exec xwin:

cp /root/.my-jwmrc /root/.jwmrc

Posted: Tue 27 Mar 2007, 01:49
by BarryK
The opinions being expressed in this thread are, to me, very peculiar. The XDG system as implemented in 2.14 is straightforward.

For JWM, if you want to modify the configuration file, you edit /etc/xdg/templates/_root_.jwmrc. If you want to change the taskbar, edit /root/.jwmrc-tray. If you want to modify or remove any particular menu entry, then edit or delete the appropriate .desktop file in /usr/share/applications.

To completely change the menu structure is a bit more involved... for example, _root_.jwmrc has this entry to generate the "Fun" menu:

Code: Select all

  PUPPYMENU jwm-xdgmenu /etc/xdg/menus/puppy-fun.menu
You can edit /etc/xdg/menus/puppy-fun.menu and matching /usr/share/desktop-directories/Puppy-Fun.directory to change things. Edit Puppy-Fun.direcory to change the label ("Games" instead of "Fun") or icon. Edit puppy-fun.menu to change the categories (and hence what .desktop files get chosen).

So, to redesign the menu structure is more involved, but if you just want to do something simple like add or remove an entry, it's a piece of cake.

Referring to the original post, if you want to make a "hardcoded" custom entry in the JWM menu, not any other w.m. menu, that is easy -- edit _root_.jwmrc and just do it. You can see /root/.jwmrc to see the format of a menu entry. You can also see in _root_.jwmrc how the "Shutdown" menu is hardcoded, and you can easily do something similar, whatever you need. In other words, it's just as easy as the old system of editing /root/.jwmrc directly.

Whatever small difficulties there are, are completely overwhelmed by the end result, which is simple automatic updating of the menu whenever a package is added and removed, for any window manager. It is the old system that was cumbersome and restricted, and it didn't even have a size advantage.

EDIT: Don't forget to run the 'fixmenus' script after editing _root_.jwmrc, to regnerate /root/.jwmrc.

Posted: Tue 27 Mar 2007, 02:43
by Pizzasgood
XDG is also less risky. All a package can do is mess up its own .desktop file, and about the worst that can do to the menu as a whole is make it's section have giant icons. Before, they had to directly edit the menu file. Any small slip and poof! All gone.

Personally, I don't trust my string parsing skills enough to like that at all, especially if you can't count on someone's menu being formatted a certain way.

Posted: Tue 27 Mar 2007, 15:01
by BarryK
That "giant icons" problem will be fixed in 2.16, at least for JWM -- a large icon will be automatically scaled down to fit.

Posted: Tue 27 Mar 2007, 16:23
by oli
I tried to change the menu in different ways. Here is my result: I run Puppy 2.14 from CD (pfix=ram) and use JWM. I added some menu entries into /root/.jwmrc and restarted JWM. My menus appeared. Then I installed a PetGet. The menu was still the same, that means my additional menu entries were available. I deleted /usr/share/applications/bubbles.desktop and restarted JWM. The menu was still the same - with my menu entries and with the bubble-entry! I edited /etc/xdg/templates/_root_.jwmrc and restarted JWM. But the menu didn't changed. It seems to me that everything is the same as in Puppy 2.10.

Posted: Tue 27 Mar 2007, 20:10
by bostonvaulter
oli, you need to run 'fixmenus' and then restart jwm to update the xdg menus.

Posted: Tue 27 Mar 2007, 20:39
by rarsa
Several comments:

1. The "right" way of preventing an entry from showing in the menu is to add
a line with "hidden=true" to the corresponding .desktop file

2. Hardcoding the location of a menu entry is done by adding the entry into the corresponding .menu file

3. Having different menu structures per Window manager is done by using different .menu files

4. The current categorization of applications in the oficial .pet files needs an overhaul. I ofered to do this by merging it with my original categorization but I've been extremelly short of time.

5. Once you have well categorized applications you rarelly require to create "ad-hoc" entries but it can still be done as described in point 2.

6. XDG implementation was as a response to a problem that was deemed more complex that the dificulty of creating hardcoded menu structures. That problem is: How do I make sure that an application shows in the menu if I don't know what WM the user is using?

Posted: Tue 27 Mar 2007, 21:21
by Dougal
BarryK wrote:The opinions being expressed in this thread are, to me, very peculiar. The XDG system as implemented in 2.14 is straightforward.
It isn't that straightforward, actually…

When I started using 2.14 I encountered a bug in it (an app I compiled appeared twice in the same menu) and asked Rarsa about it and he said you misunderstood how the XDG menus work.

I started trying to modify the JWM menu and discovered a few ways in which this is manifeted:

1) You messed up the categories in the .desktop files: your files use one "level", rather than "one;two;three" etc. which (I think) makes them incompatible with the freedesktop standard.
This causes a few problems:
- Window managers that have built-in XDG mechanisms don't recognize these files properly (also, the archaic location of icons in Puppy probably causes problems with finding icons).
- The opposite also happens: non-native .desktop files will not be recognized properly in Puppy, since they don't have the right categories… and if a user wants to make radical changes in their menu-structure (or are using an older Puppy, with Rarsa's XDG menus), then official Puppy packages will not be recognized properly.
- The menus are less flexible, since you can't structure them properly -- your .menu files have that problem, where you just "include" a whole bunch of categories and they're sorted alphabetically, rather than being in smaller groups that are each sorted (example: web-browsers mixed with the rest of the "internet" apps, rather than being at the beginning of the list).
- The fact that the .desktop files have the description in their name is also strange -- the only reason I can think of having it is for indexgen.sh, but there you can get the description from the "Comment" section of the .desktop file (this way it also finds descriptions for non-native .desktop files). I've actually modified indexgen.sh to work like that and got it working much faster (down from 36 seconds to 7 seconds).

2) As mentioned above, the .menu files are badly structured and you also don't leave much room for using the sub-menu option ("inline limit" of 99??).

3) The worst part is the whole "fixmenus" idea. The "D" in XDG stands for Dynamic, but what you do is just create a static menu using Rarsa's utilities…
The dynamic menu is created every time the WM is restarted, in the menu itself.
I'm attaching here as an example my current jwmrc, which does this using your templates.

Posted: Tue 27 Mar 2007, 21:32
by gw
Hello,

Thank you very much for your different reponses which bring a lot of clarifications for the use of this new menu.

A+
--
gw

Posted: Wed 28 Mar 2007, 05:38
by oli
Perhaps a stupid question, but I cannot find 'fixmenus'. Where is it?

By the way, I built my menu by editing /root/.jwmrc (like before in Puppy 2.10) and it works fine. And this method is very simple, convenient and flexible.

Posted: Wed 28 Mar 2007, 08:01
by bostonvaulter
oli,

'fixmenus' is a command that you need to run from the console (rxvt), if you simply edit /root/.jwmrc it will be overwritten whenever you run fixmenus and install from petget.

Jason

Posted: Wed 28 Mar 2007, 13:09
by BarryK
1) You messed up the categories in the .desktop files: your files use one "level", rather than "one;two;three" etc. which (I think) makes them incompatible with the freedesktop standard.
This causes a few problems:
- Window managers that have built-in XDG mechanisms don't recognize these files properly (also, the archaic location of icons in Puppy probably causes problems with finding icons).
- The opposite also happens: non-native .desktop files will not be recognized properly in Puppy, since they don't have the right categories… and if a user wants to make radical changes in their menu-structure (or are using an older Puppy, with Rarsa's XDG menus), then official Puppy packages will not be recognized properly.
- The menus are less flexible, since you can't structure them properly -- your .menu files have that problem, where you just "include" a whole bunch of categories and they're sorted alphabetically, rather than being in smaller groups that are each sorted (example: web-browsers mixed with the rest of the "internet" apps, rather than being at the beginning of the list).
Improving the categories is a "detail" that rarsa was going to do for me.
- The fact that the .desktop files have the description in their name is also strange
Hmmm, I used a utility created by rarsa that autogenerated those desktop files. A very nit-picking criticism.
3) The worst part is the whole "fixmenus" idea. The "D" in XDG stands for Dynamic, but what you do is just create a static menu using Rarsa's utilities…
The dynamic menu is created every time the WM is restarted, in the menu itself.
I disagree. It was my considered decision to go that way, as I wanted to avoid running rarsa's xdg-to-wm generation utility (repeatedly) everytime the window manager is started, which may have a time impact on very old hardware -- small, but it's those small things that
add up. The fixmenus system is still "dynamic", just constrained to only be done when needed.

Dougal, you need to cool down.

Posted: Wed 28 Mar 2007, 15:09
by rarsa
Dougal,

Here are some clarifications:
BarryK wrote:Improving the categories is a "detail" that rarsa was going to do for me.
I attest to this. It's just that it takes a big chunk of heads down time which I haven't had recently (read my previous post)
BarryK wrote:
- The fact that the .desktop files have the description in their name is also strange
Hmmm, I used a utility created by rarsa that autogenerated those desktop files. A very nit-picking criticism.
With that many files, I had to create the first pass with a script that parsed the full JWM menu. My thought was that whenever an application developer provides its own .desktop file, that would replace the autogenerated file. There will be a period of time where the .desktop file provided with the .pet may be different from the .desktop file provided by the author in the source package.
BarryK wrote:
3) The worst part is the whole "fixmenus" idea...
I disagree. It was my considered decision to go that way...
This is clearly a design desicion. I also had my doubts when I first saw it but I later understood the reasons:
When making design desicions you evaluate different factors and assign a relative weight to them.
As a tinker I put more weight in use the facilities provided by the WM.
Barry sees it from the user point of view and assigns more weight to that. I can clearly see as a well justified design desicion.

There are other things to consider:
- This is the first pass at the implementation. It can, and I'm sure will, be improved. (e.g. don't include the configuration portion in the jwm template)
- If absolutelly needed or desired, fixmenus can be overriden and the native WM functionality used.
- If absolutelly needed or desired, fixmenus can be overriden and a hardcoded menu file created.

So there is a lot of room for tinkers while things are simpler for regular users that don't care about messing up with the menu but want installed applications to just show in the menu.

I hope this clarified the issue.