2009-06-12

Custom desktop menu on xfce 4.6

Here's a few things I had to do to get a custom right-click desktop menu on XFCE 4.6:

1) Disable desktop icons: You have to use XFCE in "classical" Unix desktop... i.e., no icons on the desktop itself. You can still drag and drop between Thunar windows, but not between Thunar and desktop. To do this, run (from a terminal):

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

2) Next, make sure the desktop menu is enabled:
xfconf-query -c xfce4-desktop -p /desktop-menu/show-icons -s true
xfconf-query -c xfce4-desktop -p /desktop-menu/show -s true

3) Finally, edit your desktop menu as you like. The per-user desktop menu is typically in this file:
~/.config/menus/xfce-applications.menu

As an example, here is my menu file. The "Include" section contains the menu items that will be used in the "Layout" section. Menu items are described by ".desktop" files found in /usr/share/applications/. You can also define your own ".desktop" files, and place them under ~/.local/share/applications/

In the example xfce-applications.menu file shown below, I created a "virtualbox.desktop" file under my local applications directory, because I didn't find one under the system directory /usr/share/applications.

Content of ~/.config/menus/xfce-applications.menu :


<!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
"http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd">


<Menu>
<Name>My_desktop_menu</Name>

<DefaultAppDirs/>
<DefaultDirectoryDirs/>

<Include>
<Filename>xfce4-logout.desktop</Filename>
<Filename>gnome-terminal.desktop</Filename>
<Filename>xterm.desktop</Filename>
<Filename>gnucash.desktop</Filename>
<Filename>keepassx.desktop</Filename>
<Filename>rhythmbox.desktop</Filename>
<Filename>pidgin.desktop</Filename>
<Filename>virtualbox.desktop</Filename>
</Include>

<Layout>
<Filename>xterm.desktop</Filename>
<Separator/>
<Filename>gnucash.desktop</Filename>
<Separator/>
<Filename>pidgin.desktop</Filename>
<Filename>keepassx.desktop</Filename>
<Filename>rhythmbox.desktop</Filename>
<Filename>virtualbox.desktop</Filename>
<Menuname>Applications</Menuname>
<Menuname>Settings</Menuname>
<Filename>xfce4-logout.desktop</Filename>
</Layout>



<Menu>
<Name>Settings</Name>
<Directory>xfce-settings.directory</Directory>
<Include>
<Category>Settings</Category>
</Include>
<Exclude>
<Category>System</Category>
</Exclude>

<Layout>
<Filename>xfce-settings-manager.desktop</Filename>
<Separator/>
<Merge type="all"/>
</Layout>

<Menu>
<Name>Screensavers</Name>
<Directory>xfce-screensavers.directory</Directory>
<Include>
<Category>Screensaver</Category>
</Include>
</Menu>
</Menu>


<Menu>
<Name>Applications</Name>

<Menu>
<Name>Accessories</Name>
<Directory>xfce-accessories.directory</Directory>
<Include>
<Or>
<Category>Accessibility</Category>
<Category>Core</Category>
<Category>Legacy</Category>
<Category>Utility</Category>
</Or>
</Include>
</Menu>

<Menu>
<Name>Development</Name>
<Directory>xfce-development.directory</Directory>
<Include>
<Category>Development</Category>
</Include>
</Menu>

<Menu>
<Name>Education</Name>
<Directory>xfce-education.directory</Directory>
<Include>
<Category>Education</Category>
</Include>
</Menu>

<Menu>
<Name>Games</Name>
<Directory>xfce-games.directory</Directory>
<Include>
<Category>Game</Category>
</Include>
</Menu>

<Menu>
<Name>Graphics</Name>
<Directory>xfce-graphics.directory</Directory>
<Include>
<Category>Graphics</Category>
</Include>
</Menu>

<Menu>
<Name>Multimedia</Name>
<Directory>xfce-multimedia.directory</Directory>
<Include>
<Category>Audio</Category>
<Category>Video</Category>
<Category>AudioVideo</Category>
</Include>
</Menu>

<Menu>
<Name>Network</Name>
<Directory>xfce-network.directory</Directory>
<Include>
<Category>Network</Category>
</Include>
</Menu>

<Menu>
<Name>Office</Name>
<Directory>xfce-office.directory</Directory>
<Include>
<Category>Office</Category>
</Include>
</Menu>

<Menu>
<Name>System</Name>
<Directory>xfce-system.directory</Directory>
<Include>
<Category>System</Category>
</Include>
<Exclude>
<Filename>gnome-app-install-xfce.desktop</Filename>
</Exclude>
</Menu>

<Menu>
<Name>Other</Name>
<Directory>xfce-other.directory</Directory>
<OnlyUnallocated/>
<Include>
<All/>
</Include>
<Exclude>
<Category>X-Xfce-Toplevel</Category>
</Exclude>
</Menu>
</Menu>

</Menu>

1 comment: