I did a complete overhaul of my Linux box not too long ago, and in the process decided to start fresh with my /home directory, only porting configuration for things I knew I wanted to keep. One of those was my .wine folder. Everything went smoothly, but afterwards I was missing all of my Gnome menu entries for my Wine apps. Here's how I recovered them.
Wine stores its menu items in a number of different locations, and yours may differ slightly from mine. The four locations on my Ubuntu install were in ~/.config/menus/applications-merged, ~/.local/share/applications/wine, ~/.local/share/desktop-directories and ~/.local/share/icons.
Inside ~/.config/menus/applications-merged are the main Wine .menu file and a .menu file for each subfolder. For 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>wine-wine</Name> <Directory>wine-wine.directory</Directory> <Menu> <Name>wine-Programs</Name> <Directory>wine-Programs.directory</Directory> </Menu> </Menu> </Menu>
<!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>wine-wine</Name> <Directory>wine-wine.directory</Directory> <Menu> <Name>wine-Programs</Name> <Directory>wine-Programs.directory</Directory> <Menu> <Name>wine-Programs-Mozilla Firefox</Name> <Directory>wine-Programs-Mozilla Firefox.directory</Directory> <Include> <Filename>wine-Programs-Mozilla Firefox-Mozilla Firefox.desktop</Filename> <Filename>wine-Programs-Mozilla Firefox-Mozilla Firefox (Safe Mode).desktop</Filename> </Include> </Menu> </Menu> </Menu> </Menu>
These files reference data that can be found in ~/.local/share, in applications/wine/ and desktop-directories/. ~/.local/share/applications/wine/ contains a folder structure that is basically folders and .desktop launchers that emulate the same structure you will see in your menu. So, in my case, I had:
- Mozilla Firefox.desktop
- Mozilla Firefox (Safe Mode).desktop
The two .desktop files are very similar, and follow the Gnome .desktop standard.
[Desktop Entry] Name=Mozilla Firefox Exec=wine "C:\\Program Files\\Mozilla Firefox\\firefox.exe" Type=Application StartupWMClass=Wine Path=~/.wine/dosdevices/c:/Program Files/Mozilla Firefox Icon=90c5_firefox.0
Notice that this file references the icon file to be used with the menu item. This icon should be located in ~/.local/share/icons
Finally, Wine needs a little more information about the structure of the menu directories, and gets this info from .directory files located in ~/.local/share/desktop-directories. These .directory files have a struture very similar to the .desktop files, and a file is required for each directory level. This means that for "Wine > Programs > Mozilla Firefox", I end up having 3 .directory files: wine-wine.directory, wine-Programs.directory, and wine-Programs-Mozilla Firefox.directory.
[Desktop Entry] Type=Directory Name=Wine Icon=wine
[Desktop Entry] Type=Directory Name=Programs Icon=folder
[Desktop Entry] Type=Directory Name=Mozilla Firefox Icon=folder
Fortunately for me, I was only migrating data from an old ~, so these files were all still intact in their original locations, and I didn't actually have to recreate any of them (although I did have to tweak a couple). As of now I know of no way to automatically populate these files, though such a utility would be a welcome addition to every Wine user's toolkit.
The Joomla!® name is used under a limited license from Open Source Matters in the United States and other countries. Jeff Channell is not affiliated with or endorsed by Open Source Matters or the Joomla!® Project.