Organizing freedesktop Desktop Entries in Linux
Warning: compact(): Undefined variable $post_id in /srv/http/nickmcummins.com/wp-content/themes/epic-base/vendor/composer/justintadlock/hybrid-core/ext/get-the-image.php on line 307
Warning: compact(): Undefined variable $order in /srv/http/nickmcummins.com/wp-content/themes/epic-base/vendor/composer/justintadlock/hybrid-core/ext/get-the-image.php on line 307
Warning: compact(): Undefined variable $meta_key in /srv/http/nickmcummins.com/wp-content/themes/epic-base/vendor/composer/justintadlock/hybrid-core/ext/get-the-image.php on line 307
Warning: compact(): Undefined variable $featured in /srv/http/nickmcummins.com/wp-content/themes/epic-base/vendor/composer/justintadlock/hybrid-core/ext/get-the-image.php on line 307
Warning: compact(): Undefined variable $attachment in /srv/http/nickmcummins.com/wp-content/themes/epic-base/vendor/composer/justintadlock/hybrid-core/ext/get-the-image.php on line 307
Warning: compact(): Undefined variable $scan in /srv/http/nickmcummins.com/wp-content/themes/epic-base/vendor/composer/justintadlock/hybrid-core/ext/get-the-image.php on line 307
Warning: compact(): Undefined variable $scan_raw in /srv/http/nickmcummins.com/wp-content/themes/epic-base/vendor/composer/justintadlock/hybrid-core/ext/get-the-image.php on line 307
Warning: compact(): Undefined variable $callback in /srv/http/nickmcummins.com/wp-content/themes/epic-base/vendor/composer/justintadlock/hybrid-core/ext/get-the-image.php on line 307
Warning: compact(): Undefined variable $default in /srv/http/nickmcummins.com/wp-content/themes/epic-base/vendor/composer/justintadlock/hybrid-core/ext/get-the-image.php on line 307
Warning: compact(): Undefined variable $split_content in /srv/http/nickmcummins.com/wp-content/themes/epic-base/vendor/composer/justintadlock/hybrid-core/ext/get-the-image.php on line 307
Warning: compact(): Undefined variable $size in /srv/http/nickmcummins.com/wp-content/themes/epic-base/vendor/composer/justintadlock/hybrid-core/ext/get-the-image.php on line 307
Warning: compact(): Undefined variable $srcset_sizes in /srv/http/nickmcummins.com/wp-content/themes/epic-base/vendor/composer/justintadlock/hybrid-core/ext/get-the-image.php on line 307
Warning: compact(): Undefined variable $link in /srv/http/nickmcummins.com/wp-content/themes/epic-base/vendor/composer/justintadlock/hybrid-core/ext/get-the-image.php on line 307
Warning: compact(): Undefined variable $link_class in /srv/http/nickmcummins.com/wp-content/themes/epic-base/vendor/composer/justintadlock/hybrid-core/ext/get-the-image.php on line 307
Warning: compact(): Undefined variable $image_class in /srv/http/nickmcummins.com/wp-content/themes/epic-base/vendor/composer/justintadlock/hybrid-core/ext/get-the-image.php on line 307
Warning: compact(): Undefined variable $width in /srv/http/nickmcummins.com/wp-content/themes/epic-base/vendor/composer/justintadlock/hybrid-core/ext/get-the-image.php on line 307
Warning: compact(): Undefined variable $height in /srv/http/nickmcummins.com/wp-content/themes/epic-base/vendor/composer/justintadlock/hybrid-core/ext/get-the-image.php on line 307
Warning: compact(): Undefined variable $before in /srv/http/nickmcummins.com/wp-content/themes/epic-base/vendor/composer/justintadlock/hybrid-core/ext/get-the-image.php on line 307
Warning: compact(): Undefined variable $after in /srv/http/nickmcummins.com/wp-content/themes/epic-base/vendor/composer/justintadlock/hybrid-core/ext/get-the-image.php on line 307
Warning: compact(): Undefined variable $min_width in /srv/http/nickmcummins.com/wp-content/themes/epic-base/vendor/composer/justintadlock/hybrid-core/ext/get-the-image.php on line 307
Warning: compact(): Undefined variable $min_height in /srv/http/nickmcummins.com/wp-content/themes/epic-base/vendor/composer/justintadlock/hybrid-core/ext/get-the-image.php on line 307
Warning: compact(): Undefined variable $caption in /srv/http/nickmcummins.com/wp-content/themes/epic-base/vendor/composer/justintadlock/hybrid-core/ext/get-the-image.php on line 307
Warning: compact(): Undefined variable $meta_key_save in /srv/http/nickmcummins.com/wp-content/themes/epic-base/vendor/composer/justintadlock/hybrid-core/ext/get-the-image.php on line 307
Warning: compact(): Undefined variable $thumbnail_id_save in /srv/http/nickmcummins.com/wp-content/themes/epic-base/vendor/composer/justintadlock/hybrid-core/ext/get-the-image.php on line 307
Warning: compact(): Undefined variable $cache in /srv/http/nickmcummins.com/wp-content/themes/epic-base/vendor/composer/justintadlock/hybrid-core/ext/get-the-image.php on line 307
Warning: compact(): Undefined variable $format in /srv/http/nickmcummins.com/wp-content/themes/epic-base/vendor/composer/justintadlock/hybrid-core/ext/get-the-image.php on line 307
Warning: compact(): Undefined variable $echo in /srv/http/nickmcummins.com/wp-content/themes/epic-base/vendor/composer/justintadlock/hybrid-core/ext/get-the-image.php on line 307
Warning: compact(): Undefined variable $custom_key in /srv/http/nickmcummins.com/wp-content/themes/epic-base/vendor/composer/justintadlock/hybrid-core/ext/get-the-image.php on line 307
Warning: compact(): Undefined variable $default_size in /srv/http/nickmcummins.com/wp-content/themes/epic-base/vendor/composer/justintadlock/hybrid-core/ext/get-the-image.php on line 307
Warning: compact(): Undefined variable $the_post_thumbnail in /srv/http/nickmcummins.com/wp-content/themes/epic-base/vendor/composer/justintadlock/hybrid-core/ext/get-the-image.php on line 307
Warning: compact(): Undefined variable $image_scan in /srv/http/nickmcummins.com/wp-content/themes/epic-base/vendor/composer/justintadlock/hybrid-core/ext/get-the-image.php on line 307
Warning: compact(): Undefined variable $default_image in /srv/http/nickmcummins.com/wp-content/themes/epic-base/vendor/composer/justintadlock/hybrid-core/ext/get-the-image.php on line 307
Warning: compact(): Undefined variable $order_of_image in /srv/http/nickmcummins.com/wp-content/themes/epic-base/vendor/composer/justintadlock/hybrid-core/ext/get-the-image.php on line 307
Warning: compact(): Undefined variable $link_to_post in /srv/http/nickmcummins.com/wp-content/themes/epic-base/vendor/composer/justintadlock/hybrid-core/ext/get-the-image.php on line 307
This took me a while to get down — given the complexity introduced here in the number of possible locations for things to be configured at a user and global level — but I have been able to create desktop directory entries and have them appear in whiskermenu properly. I highly recommend not to use a tool sure as alacarte or xame, as they may introduce more complexity and complicate your configuration files to the point that they are impossible to edit and produce any results in your menu.
➜ ls /home/nick/.local/share/desktop-directories alacarte-made-1.directory chrome-apps.directory gps-apps.directory alacarte-made.directory development-apps.directory settings-apps.directory chat-apps.directory game-apps.directory
Here’s the contents of game-apps.directory
as an example to be followed for all the category files you create:
[Desktop Entry] Comment= Type=Directory Name=Games Icon=/home/nick/Pictures/icons/IconScanner/png/GameCenter.png
My .menu
files are stored in a subdirectory called applications-merged
because of the fact that I used various GUI tools to create my entries. Placing your .menu
files in the parent menus directory should suffice.
➜ ls /home/nick/.config/menus/applications-merged chat-apps.menu game-apps.menu theplatform-apps.menu xdg-desktop-menu-dummy.menu development-apps.menu gps-apps.menu user-chrome-apps.menu
The freedesktop .menu file looks as follows, for our games category example:
<!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN" "http://www.freedesktop.org/standards/menu-spec/menu-1.0.dtd"> <Menu> <Name>Applications</Name> <Menu> <Name>game-apps</Name> <Directory>game-apps.directory</Directory> <Include> <Filename>American Truck Simulator.desktop</Filename> <Filename>steam.desktop</Filename> <Filename>m64py.desktop</Filename> <Filename>desmume.desktop</Filename> <Filename>dolphin-emu.desktop</Filename> <Filename>PPSSPP.desktop</Filename> <Filename>chrome-ikffjkehicicbeijfeneenheeijonfjc-Default.desktop</Filename> <Filename>flightgear.desktop</Filename> </Include> </Menu> </Menu>
These *.desktop
files must exist in an applications directory:
➜ ls /usr/share/applications | grep steam steam.desktop
and the contents of one should look something like
[Desktop Entry] Name=Steam Comment=Application for managing and playing games on Steam Exec=/usr/bin/steam %U Icon=steam Terminal=false Type=Application Categories=Network;FileTransfer;Game; MimeType=x-scheme-handler/steam; Exec=steam steam://open/friends
Finally, you will need to add an entry to a .menu
file similar to the following. My full menu file’s path is /home/nick/.config/menus/xfce-applications.menu
since I am using XFCE as my desktop environment:
<Menu> <Name>game-apps</Name> <Directory>game-apps.directory</Directory> <Layout> <Merge type="menus"/> <Filename>American Truck Simulator.desktop</Filename> <Filename>steam.desktop</Filename> <Separator/> <Filename>dolphin-emu.desktop</Filename> <Filename>desmume.desktop</Filename> <Filename>m64py.desktop</Filename> <Filename>PPSSPP.desktop</Filename> <Separator/> <Filename>flightgear.desktop</Filename> <Separator/> <Filename>chrome-ikffjkehicicbeijfeneenheeijonfjc-Default.desktop</Filename> <Merge type="files"/> </Layout> </Menu> <Layout> <Merge type="menus"/> <Menuname>game-apps</Menuname> </Layout> </Menu>