Page 1 of 1

Creating menu with Wine and favourites apps in XFCE.

Posted: Mon Dec 14, 2009 2:32 pm
by szamot83
Favourites Apps Menu it was something that (for me) always missing in XFCE. I have some apps which I using everyday, and I don't want to search them in menu. I have decided to make my own menu and share this “HOW TO” with you.

All menu entries are in those folders:

Code: Select all

/usr/local/share/applications
/usr/share/applications
~/.local/share/applications
(~/ - means your home directory)

When you look into one of those folders you will find plenty of “.desktop” files. Those are all programs which are shown in menu. Every file has similar to each other content. It looks sth. like this.

Code: Select all

[Desktop Entry]

Version=1.0

Name=Firefox Web Browser

Exec=firefox %u

Terminal=false

X-MultipleArgs=false

Type=Application

Icon=firefox-3.5

Categories=Application;Network;
MimeType=text/html;text/xml;application/xhtml+xml;application/xml;application/vnd.mozilla.xul+xml;application/rss+xml;application/rdf+xml;image/gif;image/jpeg;image/png;

StartupWMClass=Firefox

StartupNotify=true
I think that there is nothing to explain – it is easy, so keep focus on “Categories” line. I f you want to make Firefox your favourite application just edit firefox.desktop file (as root) and add “favourite;” word to “categories” line.

Before:

Code: Select all

Categories=Application;Network;
After:

Code: Select all

Categories=Application;Network;favourite;
Now add this word in the same place to several apps which you want to have in favourites menu.

Now you have to make a choice:
1.I want to have submenu favourites in my XFCE menu
Image
2.I want to have menu favourites on panel.
Image

1

If you want to do this you'll have to edit xfce-applications.menu. You should find this file in:

Code: Select all

/etc/xdg/menus/

or 

~/.config/menus
If you have file in ~/.config/menus, than do not edit xdg file. The xdg file should be edited as root. In both cases make backup.

Now this file contains your menu structure. If you want to have favourites submenu in XFCE menu just add those lines:

Code: Select all

    <Menu>
        <Name>Favourite</Name>
        <Include>
            <Category>favourite</Category>
        </Include>
    </Menu>

Before:

Code: Select all

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

<Menu>
    <Name>Xfce</Name>
    
    <DefaultAppDirs/>
    <DefaultDirectoryDirs/>
    
    <Include>
        <Category>X-Xfce-Toplevel</Category>
    </Include>

    <Layout>
        <Filename>xfce4-run-program.desktop</Filename>
        <Separator/>
        <Filename>xfce4-term.desktop</Filename>
        <Filename>xfce4-file-manager.desktop</Filename>
        <Filename>xfce4-web-browser.desktop</Filename>
        <Separator/>
        <Menuname>Settings</Menuname>
        <Separator/>
        <Merge type="all"/>
        <Separator/>
        <Filename>xfce4-help.desktop</Filename>
        <Filename>xfce4-about-xfce.desktop</Filename>
        <Filename>xfce4-logout.desktop</Filename>
    </Layout>
    
    <Menu>
        <Name>Settings</Name>
        <Directory>xfce-settings.directory</Directory>
        <Include>
            <Category>Settings</Category>
        </Include>
        
        <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>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>
    </Menu>

    <Menu>
        <Name>Favourites</Name>
        <Include>
            <Category>favourite</Category>
        </Include>
    </Menu>

</Menu>
After:

Code: Select all

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

<Menu>
    <Name>Xfce</Name>
    
    <DefaultAppDirs/>
    <DefaultDirectoryDirs/>
    
    <Include>
        <Category>X-Xfce-Toplevel</Category>
    </Include>

    <Layout>
        <Filename>xfce4-run-program.desktop</Filename>
        <Separator/>
        <Filename>xfce4-term.desktop</Filename>
        <Filename>xfce4-file-manager.desktop</Filename>
        <Filename>xfce4-web-browser.desktop</Filename>
        <Separator/>
        <Menuname>Settings</Menuname>
        <Separator/>
        <Merge type="all"/>
        <Separator/>
        <Filename>xfce4-help.desktop</Filename>
        <Filename>xfce4-about-xfce.desktop</Filename>
        <Filename>xfce4-logout.desktop</Filename>
    </Layout>
    
    <Menu>
        <Name>Settings</Name>
        <Directory>xfce-settings.directory</Directory>
        <Include>
            <Category>Settings</Category>
        </Include>
        
        <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>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>
    </Menu>

    <Menu>
        <Name>Favourites</Name>
        <Include>
            <Category>favourite</Category>
        </Include>
    </Menu>

</Menu>
Now save file and favourites submenu should appear. If not – click RMB on XFCE menu, chose properties, then “menu file”, and choose menu file that you have edited.


2

Make file (in terminal):

Code: Select all

touch ~/.config/menus/Favourites.menu
Edit this and add those lines:

Code: Select all

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

<Menu>
    <Name>favourite</Name>
    
    <DefaultAppDirs/>
    <DefaultDirectoryDirs/>
    
    <Include>
        <Category>favourite</Category>
    </Include>
</Menu>

Now add “XFCE Menu Panel plugin” to your panel. Click RMB on this menu and choose properties, then “menu file” and choose favourites.menu which you have edited (~/.config/menus/Favourites.menu). Now it should work.

-----------------------------------------------------------------------------------------------------



The worst defect in this tutorial is, that every time you upgrade app the new .desktop file will be written, so you will have to edit this again. To prevent this, just copy your favourites apps .desktop files to "~/.local/share/applications directory", edit them, delete every word after = in categories line and paste there word “favourite”
It should look like this:
Categories=favourite;


That's all.

P.S. I know that my English is poor. If you notice some errors or “hard to understand sentences” just post here.
P.S.2 Administrator – feel free to edit this.

Re: Creating menu with favourites apps in XFCE.

Posted: Sat Dec 19, 2009 12:19 am
by breaker
Thanks, this saved me having to do the research!

Re: Creating menu with favourites apps in XFCE.

Posted: Sat Dec 19, 2009 4:22 am
by szamot83
ok.

Maybe you would like to add wine submenyu to your menu. Lines added to menu file:

Code: Select all

    <Menu>
        <Name>Wine</Name>
        <Directory>wine-wine.directory</Directory>
        <Include>
            <Category>Wine</Category>
        </Include>
            <Menu>
                <Name>Accesory</Name>
                <Directory>wine-Programs.directory</Directory>
                <OnlyUnallocated/>
                <Include>
                    <All/>
                    <Category>Wine-Programs</Category> 
                </Include>
            </Menu>
    </Menu>
I know that there shouldn't be <OnlyUnallocated/, but when I have added category

Code: Select all

<Category>Wine-Programs-Accessories</Category>
Programs not showing, so I decided to add there unallocated files - and it works.

Image

Re: Creating menu with favourites apps in XFCE.

Posted: Sat Dec 19, 2009 7:00 am
by viking777
That is an excellent piece of work my friend, thanks for that, I have adopted it on Sidux where I use Xfce.

It begs the question though - why should it be that difficult?

A menu, any menu, even a grub menu (grub2 devs please note), is the property of the user NOT the property of the developer. As such it should NEVER be written as an xml file unless a sensible graphical program exists to easily edit that xml file. Xfce has had this menu system for a long time now and it is not acceptable for most users to have to edit a menu in the manner you describe. Xfce is a good choice for those disaffected with KDE4, but will never compete with Gnome while they have this closed mind attitude to menu entries.

Once again though, thanks for posting this how-to, it should be a made sticky post in this section.

Re: Creating menu with Wine and favourites apps in XFCE.

Posted: Mon Dec 21, 2009 2:56 pm
by szamot83
viking777 thank you for your comment.
It begs the question though - why should it be that difficult?
Second question is, is menu issue is fault of XFCE, or WINE (or another apps)? I didn't have found any answers in specification on freedesktop.org (or maybe my English is too poor).

Re: Creating menu with Wine and favourites apps in XFCE.

Posted: Tue Dec 22, 2009 5:43 am
by viking777
szamot83 wrote: Second question is, is menu issue is fault of XFCE, or WINE (or another apps)? I didn't have found any answers in specification on freedesktop.org (or maybe my English is too poor).
Well, I don't even use Wine so as far as I am concerned it is entirely the fault of Xfce.

BTW. Your English is a lot better than you make out!