Results 1 to 8 of 8

Thread: How to edit your right click menu in Xfce 4.6+

Threaded View

  1. #1
    Join Date
    Aug 2007
    Beans
    75

    How to edit your right click menu in Xfce 4.6+

    Hey guys, switched to the new Xfce today. The only thing I found to my disliking was that the right click menu was not being easily customizable. Took me about an hour to customize it to my needs so I thought I'd give a quick tut on how to change it and also share my own config. (Check bottom)

    First thing you need to do is: backup your xfce-applications.menu-file.

    Open a terminal and type:
    Code:
    cd /etc/xdg/xubuntu/menus/
    sudo cp xfce-applications.menu xfce-applications.menu_bak
    To verify progress open thunar (or whatever file manager you're using) and browse to "/etc/xdg/xubuntu/menus/" and there should be these two files:
    Code:
    xfce-applications.menu
    xfce-applications.menu_bak
    Next step is to edit the actual file. This is where the easy part ends. Open the file as root with your favorite text editor.

    Code:
    cd /etc/xdg/xubuntu/menus/
    sudo mousepad xfce-applications.menu
    The top of the document should look like this:
    Code:
    <!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>
            <Filename>gnome-app-install-xfce.desktop</Filename>
            <Filename>xubuntu-help.desktop</Filename>
            <Filename>xfce4-about-xfce.desktop</Filename>
            <Filename>xfce4-logout.desktop</Filename>
        </Include>
    
        <Layout>
            <Filename>gnome-app-install-xfce.desktop</Filename>
            <Separator/>
            <Menuname>Settings</Menuname>
            <Separator/>
            <Merge type="all"/>
            <Separator/>
            <Filename>xubuntu-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>
            <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>
    Now the part we want to focus on is understanding how the file works so that we can edit the different parts. This is what I did:

    1) Removed the "Add/Remove...", "Help", "About XFCE" menu items.

    2) Moved the Application menus (Accessories, Games, Graphics, Multimedia, Network, Office) into a Application menu.

    3) Added shortcuts for most common applications.

    4) Made my own launcher. (xkill)



    Step 1. Removing entrys:


    At the top of the document there is an <Include> section (originally line 10-15). To remove entrys we first want to remove them from here and then from the <Layout> section just beneath the <Include> section (originally line 17-27).

    I removed these three entrys from both the Include and the Layout clauses:
    Code:
    <Filename>gnome-app-install-xfce.desktop</Filename>
    <Filename>xubuntu-help.desktop</Filename>
    <Filename>xfce4-about-xfce.desktop</Filename>
    Save your file to see if the changes worked. Don't be alarmed if it takes 15 secs to update the menu. If you rightclick on the desktop and the menu doesn't show up it means that you've done something that breaks the app. So:

    In case of a broken menu:

    Code:
    cd /etc/xdg/xubuntu/menus/
    sudo rm xfce-applications.menu
    sudo cp xfce-applications.menu_bak xfce-applications.menu
    This restores the original menu. If you're extremely paranoid about your progress I would make a second backup. (Or press ctrl+z in the text editor, save, try the menu again and repeat until it works.)



    Step 2. Moving the Accessories, Games, Graphics, Multimedia, Network and office menus into a Application menu


    Open your menu file and go to the part where it says:
    Code:
        <Menu>
            <Name>Accessories</Name>
    Now you want to add a menu on top of this entry so it looks like this:
    Code:
      <Menu>
                 <Name>Applications</Name>
              <Menu>
            <Name>Accessories</Name>
    You also have to add a </Menu> below the last sub-menu, which should be "Office" and furthermore look something like this:
    Code:
        <Menu>
            <Name>Office</Name>
            <Directory>xfce-office.directory</Directory>
            <Include>
                <Category>Office</Category>
            </Include>
        </Menu>
    </Menu>
    Now you should end up with an "Applications" menu that contains the 6 sub-menus.

    I also did this with the two menus called "System" and "Settings" but added them into a menu called "Options"


    Step 1. Adding shortcuts:


    Open a new file manager and browse to:
    Code:
    /usr/share/applications
    Open your xfce-applications.menu-file and go to the section called <Include> near the top. Now look in the /usr/share/applications for the program you want to include.

    Now Right-click on the launcher-> Properties -> General (tab)

    In file name it should say something like "firefox.desktop"

    In the <Include> section you now need to make an entry (in firefox's case) called:

    <Filename>firefox.desktop</Filename>

    Next step is to add the same thing to the <Layout> section just below. This gives you a "Firefox Web Browser" entry to your right-click menu.

    I added the terminal, file manager, firefox, pidgin, banshee to my right-click menu. And they all gave me their "/usr/share/applications" icon name. DO NOT WANT!

    To change their names in the menu open the launcher in a text editor using using this command for firefox.
    Code:
    cd /usr/share/applications/
    sudo mousepad firefox.desktop
    To know the launchers actual file names you can enter this into a terminal:
    Code:
    cd /usr/share/applications/
    ls
    This lists the contents of /usr/share/applications/

    Moving on to the actual editing, the file you opened should look something like this:

    Code:
    [Desktop Entry]
    Exec=banshee-1 --redirect-log --play-enqueued %U
    Version=1.0
    Name=Banshee Media Player
    GenericName=Media Player
    Comment=Play and organize your media collection
    Icon=media-player-banshee
    StartupNotify=true
    Terminal=false
    Type=Application
    Categories=GNOME;Audio;Music;Player;AudioVideo;X-Ximian-Main;X-Novell-Main;X-Red-Hat-Base;
    X-GNOME-Bugzilla-Bugzilla=GNOME
    X-GNOME-Bugzilla-Product=banshee
    X-GNOME-Bugzilla-Component=General
    X-GNOME-Bugzilla-Version=1.4.3
    MimeType=application/musepack;application/ogg;application/rss+xml;application/x-ape;application/x-democracy;application/x-extension-m4a
    What you want to change is the part where it says "Name=Banshee Media Player" to something like this:
    Code:
    [Desktop Entry]
    Exec=banshee-1 --redirect-log --play-enqueued %U
    Version=1.0
    Name=Banshee
    GenericName=Media Player
    Comment=Play and organize your media collection
    Icon=media-player-banshee
    StartupNotify=true
    Terminal=false
    Type=Application
    Categories=GNOME;Audio;Music;Player;AudioVideo;X-Ximian-Main;X-Novell-Main;X-Red-Hat-Base;
    X-GNOME-Bugzilla-Bugzilla=GNOME
    X-GNOME-Bugzilla-Product=banshee
    X-GNOME-Bugzilla-Component=General
    X-GNOME-Bugzilla-Version=1.4.3
    MimeType=application/musepack;application/ogg;application/rss+xml;application/x-ape;application/x-democracy;application/x-extension-m4a
    If there are many language specific names you'll need to either remove all of them so that you only have "Name=X" left or you need to edit the one for the language you're using.



    Step 4. Add your own launchers:


    Copy an existing *.desktop file and rename it, this example uses the firefox.desktop to create an xkill.desktop. Just substitute xkill for whatever you want your launchers name to be:
    Code:
    cd /usr/share/applications/
    sudo cp firefox.desktop xkill.desktop
    Now open the one you created as root with a text editor:
    Code:
    cd /usr/share/applications/
    sudo mousepad xkill.desktop
    Remove everything in the text pad and add this instead:
    Code:
    [Desktop Entry]
    Name=Force Quit
    Comment=Force Quit an application 
    TryExec=xkill
    Exec=xkill
    Icon=utilities-terminal
    Type=Application

    The bold part executes a bash command. There you can insert anything, for instance I modded the terminal to open with "Exec=xfce4-terminal --geometry=70x16"

    So go nuts.

    Don't forget to change the "Name=X" to whatever you want it to appear as in your menu.

    Now just add:
    Code:
    <Filename>xkill.desktop</Filename>
    To both the Include and Layout sections near the top. To add separators just add "<Separator/>" wherever you want it in the Layout section.

    This tutorial should give you a good perception of how the new Xfce right-click menu works. Config and screenshot are attached!
    Attached Images Attached Images
    Attached Files Attached Files
    Last edited by Fixel; March 25th, 2009 at 10:39 AM.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •