How to edit the xdg menu?

Using applications, configuring, problems
Message
Author
gw
Posts: 89
Joined: Sat 22 Apr 2006, 20:19
Location: Suisse
Contact:

How to edit the xdg menu?

#1 Post 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

User avatar
HairyWill
Posts: 2928
Joined: Fri 26 May 2006, 23:29
Location: Southampton, UK

#2 Post 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.
Last edited by HairyWill on Wed 28 Mar 2007, 08:28, edited 1 time in total.
Will
contribute: [url=http://www.puppylinux.org]community website[/url], [url=http://tinyurl.com/6c3nm6]screenshots[/url], [url=http://tinyurl.com/6j2gbz]puplets[/url], [url=http://tinyurl.com/57gykn]wiki[/url], [url=http://tinyurl.com/5dgr83]rss[/url]

User avatar
bostonvaulter
Posts: 269
Joined: Wed 27 Sep 2006, 03:41

#3 Post 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.
[img]http://img.photobucket.com/albums/v212/BostonVaulter/avatar/puppybar.png[/img]

User avatar
Dougal
Posts: 2502
Joined: Wed 19 Oct 2005, 13:06
Location: Hell more grotesque than any medieval woodcut

#4 Post 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).
What's the ugliest part of your body?
Some say your nose
Some say your toes
But I think it's your mind

raffy
Posts: 4798
Joined: Wed 25 May 2005, 12:20
Location: Manila

use the old .jwmrc

#5 Post 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.

User avatar
alienjeff
Posts: 2265
Joined: Sat 08 Jul 2006, 20:19
Location: Winsted, CT - USA

#6 Post 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.
[size=84][i]hangout:[/i] ##b0rked on irc.freenode.net
[i]diversion:[/i] [url]http://alienjeff.net[/url] - visit The Fringe
[i]quote:[/i] "The foundation of authority is based upon the consent of the people." - Thomas Hooker[/size]

Kal
Posts: 626
Joined: Thu 05 May 2005, 16:59
Location: California, High Desert

#7 Post 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

GuestToo
Puppy Master
Posts: 4083
Joined: Wed 04 May 2005, 18:11

#8 Post 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

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

#9 Post 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.
Last edited by BarryK on Tue 27 Mar 2007, 15:23, edited 1 time in total.

User avatar
Pizzasgood
Posts: 6183
Joined: Wed 04 May 2005, 20:28
Location: Knoxville, TN, USA

#10 Post 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.
[size=75]Between depriving a man of one hour from his life and depriving him of his life there exists only a difference of degree. --Muad'Dib[/size]
[img]http://www.browserloadofcoolness.com/sig.png[/img]

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

#11 Post 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.

oli
Posts: 194
Joined: Wed 30 Aug 2006, 09:04
Location: Germany, Frankfurt

#12 Post 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.

User avatar
bostonvaulter
Posts: 269
Joined: Wed 27 Sep 2006, 03:41

#13 Post by bostonvaulter »

oli, you need to run 'fixmenus' and then restart jwm to update the xdg menus.
[img]http://img.photobucket.com/albums/v212/BostonVaulter/avatar/puppybar.png[/img]

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

#14 Post 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?
[url]http://rarsa.blogspot.com[/url] Covering my eclectic thoughts
[url]http://www.kwlug.org/blog/48[/url] Covering my Linux How-to

User avatar
Dougal
Posts: 2502
Joined: Wed 19 Oct 2005, 13:06
Location: Hell more grotesque than any medieval woodcut

#15 Post 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.
Attachments
jwmrc.gz
(1.48 KiB) Downloaded 730 times
What's the ugliest part of your body?
Some say your nose
Some say your toes
But I think it's your mind

gw
Posts: 89
Joined: Sat 22 Apr 2006, 20:19
Location: Suisse
Contact:

#16 Post 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

oli
Posts: 194
Joined: Wed 30 Aug 2006, 09:04
Location: Germany, Frankfurt

#17 Post 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.

User avatar
bostonvaulter
Posts: 269
Joined: Wed 27 Sep 2006, 03:41

#18 Post 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
[img]http://img.photobucket.com/albums/v212/BostonVaulter/avatar/puppybar.png[/img]

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

#19 Post 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.

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

#20 Post 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.
[url]http://rarsa.blogspot.com[/url] Covering my eclectic thoughts
[url]http://www.kwlug.org/blog/48[/url] Covering my Linux How-to

Post Reply