Tuesday, June 21, 2011

Edit Xfce 4.6 right-click menu in SalineOS

I finally figured out how to customize the right-click menu in Xfce 4.6 in SalineOS. It's a simple task in Xfce 4.4 and earlier versions because those versions have a handy menu editor (so does Xfce 4.8), but the menu in Xfce 4.6 has to be edited manually. Not for the faint of heart.

Here's how it looked when I right-clicked on the desktop in SalineOS:

I wanted to get rid of all that Thunar stuff ("Open in New Window," "Create Launcher," "Create URL Link," etc.) and show only the items that appeared under the Applications sub-menu, which looked like what appeared in the main menu from the panel:

Then I wanted to customize that menu.

Here are the steps:

Created ~/.config/menus directory.
Copied /etc/xdg/menus/xfce-applications.menu to ~/.config/menus/xfce-applications.menu.

At this point, the right-click menu still looks like the default. It has all of the Thunar stuff, and the “Applications” sub-menu contains everything you see if you click on the panel's main menu icon. To get rid of the Thunar stuff, I ran:

 $ xfconf-query -c xfce4-desktop -v --create -p /desktop-icons/style -t int -s 0

See man xfconf-query. The above command creates a new property named “/desktop-icons/style” for the xfce4-desktop “channel” and gives it type “integer” and sets the type to 0 (=OFF).

To toggle back and forth between the two properties:

$ xfconf-query -c xfce4-desktop -v -p /desktop-icons/style -s 0


$ xfconf-query -c xfce4-desktop -v -p /desktop-icons/style -s 2

The following command gives a list of properties for the xfce4-desktop “channel”:

$ xfconf-query -c xfce4-desktop -l

And this command shows the same as above, but shows the settings:

$ xfconf-query -c xfce4-desktop -lv

To edit the menu, I edited ~/.config/menus/xfce-applications.menu. As an example, here are the steps for adding a menu entry for Google Chrome:

First, I looked in /usr/share/applications for the name of the .desktop file, then added the following line to both the “Include” and “Layout” sections:


To edit the actual application name that showed up in the menu:

# gedit /usr/share/applications/google-chrome.desktop

There, I edited the following line:


Changes to those .desktop entries apparently don't take effect without starting a new session.

For Dolphin, I had to first copy the .desktop file from /usr/share/applications/kde4:

# cp /usr/share/applications/kde4/dolphin.desktop /usr/share/applications/dolphin.desktop

Then, followed the same steps as above.

Here's how it looks now when I right-click on the desktop in SalineOS:


kajukenbo said...

Your notes here are pointing me in the right direction, but in 4.10 I get the "classic" right click menu using your tips but I lose the desktop icons.

How do I get the desktop icons AND the old menu? Any ideas?

FTR, "xfconf-query -c xfce4-desktop -v --create -p /desktop-icons/style -t int -s 1" gives me desktop icons for the open applications.


MALsPa said...

kajukenbo, the latest Xfce I currently have installed here is 4.8, in Debian Wheezy. Sad to say, I haven't even tried to edit the menu yet. I ended up simply putting a few icons on the panel for my most frequently used apps.

But another thing is, I don't use desktop icons.

So, I'm not sure that I can help with this, but your comment towards the end of your post makes me think that you might be close to figuring it out.

And, not sure if this info will help, but see if the info at Arch's wiki gives you any clues: https://wiki.archlinux.org/index.php/Xfce

I think that's where I first came up with the idea of using xfconf-query commands.

Good luck, and if you get time, let me know how it goes! I'll try to look into a bit more, too. I know that using Alacarte for editing the Xfce menu is an option, but I've been avoiding that option because Alacarte brings in so many dependencies.