You are not logged in.

#1 2014-07-16 04:03:46

heyitstallchris
Member
Registered: 2013-10-01
Posts: 23

[SOLVED] XFCE customize menu help: applications and directory menu

I've been trying to make some progress with customizing XFCE menus. There are two menus I'm trying to create, listed below.

Yes, i have read http://wiki.xfce.org/howto/customize-menu
No, I'm not saying I understood all of it.

1. I want to have a custom Applications menu that lists all installed applications, without categorization. Preferably alphabetical. I'm guessing it has a lot to do with adding a lot of <include> directives.

Here's what I've tinkered with so far, which produces categories of apps.

<!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/>
    <DefaultMergeDirs/>

    <Include>
        <Filename>xfce4-run.desktop</Filename>
    </Include>

    <Layout>
        <Merge type="all"/>
        <Separator/>
        <Menuname>Settings</Menuname>
        <Filename>xfce4-run.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>
        <Exclude>
            <Or>
                <Filename>exo-file-manager.desktop</Filename>
                <Filename>exo-terminal-emulator.desktop</Filename>
                <Filename>xfce4-about.desktop</Filename>
                <Filename>xfce4-run.desktop</Filename>
            </Or>
        </Exclude>
    </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>
        <Exclude>
            <Or>
                <Filename>exo-mail-reader.desktop</Filename>
                <Filename>exo-web-browser.desktop</Filename>
            </Or>
        </Exclude>
    </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>
            <Or>
                <Category>Emulator</Category>
                <Category>System</Category>
            </Or>
        </Include>
        <Exclude>
            <Or>
                <Filename>xfce4-session-logout.desktop</Filename>
            </Or>
        </Exclude>
    </Menu>

    <Menu>
        <Name>Other</Name>
        <Directory>xfce-other.directory</Directory>
        <OnlyUnallocated/>
        <Include>
            <All/>
        </Include>
    </Menu>

</Menu>

2. I want to make a different Directory menu, possibly by implicating a custom Applications menu. If I could locate the .menu file for the Directory menu panel item, I would like to make minor adjustments to the menu, and invoke it through the Applications menu panel item.
I should state that what I'm trying to accomplish is
a) to remove the submenu-like options with the Directory menu (open Folder, open in Terminal) to have one-click to open the folder directory
b) to add a label next to the panel icon (aesthetics), which would be accomplished through using the Applications menu panel item.

Edit: clarity

Last edited by heyitstallchris (2014-07-31 02:02:36)

Offline

#2 2014-07-16 05:32:26

ConnorBehan
Package Maintainer (PM)
From: Long Island NY
Registered: 2007-07-05
Posts: 1,359
Website

Re: [SOLVED] XFCE customize menu help: applications and directory menu

1. There is no magic to listing all programs, you just have to do it manually. Get rid of all "<Category>" tags and then inside the first "<Menu>" tag write:

<Include>
    <Filename>first_file.desktop</Filename>
    ...
    <Filename>last_file.desktop</Filename>
</Include>

<Layout>
    <Filename>first_file.desktop</Filename>
    ...
    <Filename>last_file.desktop</Filename>
</Layout>

It will be tedious the first time you make it. But soon you will be able to make a pacman hook which adds a desktop file to the list every time a new one is installed.

2. Are you trying to remove certain items from the menu that Thunar gives when you right click on a directory? Thunar plugins allow you to add items but I think patching Thunar is the only way to remove them. This has nothing to do with application menus.


6EA3 F3F3 B908 2632 A9CB E931 D53A 0445 B47A 0DAB
Great things come in tar.xz packages.

Offline

#3 2014-07-16 18:49:56

heyitstallchris
Member
Registered: 2013-10-01
Posts: 23

Re: [SOLVED] XFCE customize menu help: applications and directory menu

Thank you for confirming what I needed to do, pretty straight forward.

ConnorBehan wrote:

It will be tedious the first time you make it.

It really didn't take too long after I looked up an awk script to add <Filename></Filename>

$ awk '{print "before_"$0"_after"}' infile

It was even easier once I saw most were duplicate "Settings" menu entries, which I removed from the .menu.

ConnorBehan wrote:

But soon you will be able to make a pacman hook which adds a desktop file to the list every time a new one is installed.

Googling takes this all the way back to '07, so I think I'm crossing my fingers for the time being.

Still need a solution to alphabetize, especially once my list gets longer. Should be noted that the .desktop file name and what shows up in menu are not always the same, so that could be tricky.


ConnorBehan wrote:

2. Are you trying to remove certain items from the menu that Thunar gives when you right click on a directory? Thunar plugins allow you to add items but I think patching Thunar is the only way to remove them. This has nothing to do with application menus.

I'm talking about the Panel>Item>Directory Menu item,
http://docs.xfce.org/xfce/xfce4-panel/directorymenu?s

Last edited by heyitstallchris (2014-07-16 18:51:31)

Offline

#4 2014-07-17 09:01:08

Padfoot
Member
Registered: 2010-09-03
Posts: 381

Re: [SOLVED] XFCE customize menu help: applications and directory menu

Firstly, I'll tackle menu 1.

No need to create an include line for every .desktop file. Do the following:

$ mkdir ~/.config/menus
$ cd ~/.config/menus
$ touch custom-apps.menu

Edit the file we have just created and populate it with the following:

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

<Menu>
    <Name>Applications</Name>

    <DefaultAppDirs/>
    <DefaultDirectoryDirs/>
    <DefaultMergeDirs/>

    <Include>
        <Category>X-Xfce-Toplevel</Category>
        <Category>Settings</Category>
        <Category>Accessibility</Category>
        <Category>Core</Category>
        <Category>Legacy</Category>
        <Category>Utility</Category>
        <Category>Development</Category>
        <Category>Education</Category>
        <Category>Game</Category>
        <Category>Graphics</Category>
        <Category>Audio</Category>
        <Category>Video</Category>
        <Category>AudioVideo</Category>
        <Category>Network</Category>
        <Category>Office</Category>
        <Category>System</Category>
    </Include>

    <Layout>
        <Merge type="all"/>
    </Layout>

</Menu>

Now just create an application menu panel item and point it to the custom menu file we just created.

This will display every application installed on your system, and any custom .desktop entries you may create (as long as they are set in one of the categories in the menu file). Add or remove categories as you need.
If you want to have the "Run Program" and other "Action" items that are in the default Xfce menu, add a category line for "X-Xfce-Toplevel"

Alternatively, you can forego all the <Category></Category> lines and simply use <All/>
[EDIT] and since this is using garcon (Xfce's menu library), the apps will be in alphabetical order [/EDIT]

Cheers.

Last edited by Padfoot (2014-07-17 09:42:16)

Offline

#5 2014-07-17 09:32:20

Padfoot
Member
Registered: 2010-09-03
Posts: 381

Re: [SOLVED] XFCE customize menu help: applications and directory menu

Now on to menu 2:

You are going to have to do this manually. The Directory Menu panel item is hard coded to use the "Places" items in the left pane of Thunar, so there is no menu file to edit as such. You will need to create your own menu as follows:

$ cd ~/.config/menus
$ touch custom-directories.menu

Edit the menu file we just created and populate it as follows:

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

<Menu>
    <Name>Directories</Name>

    <DefaultAppDirs/>
    <DefaultDirectoryDirs/>
    <DefaultMergeDirs/>

    <Include>
        <Category>X-Directories</Category>
    </Include>

    <Layout>
        <Merge type="all"/>
    </Layout>

</Menu>

Now you need to make a .desktop file for each directory you want to open directly from the menu:

$ mkdir ~/.local/share/applications/x-directories

(This is optional, you can just save your .desktop files in ~/.local/share/applications but this will keep directories separate from any custom application .desktop files)

[Desktop Entry]
Type=Application
Encoding=UTF-8
Name=Music
Exec=thunar ~/Music
Icon=folder
Categories=X-Directories;

Simply save each file in ~/.local/share/applications or ~/.local/share/applications/x-directories (if you made this directory). Save the file with a name as follows (based on the file above) x-music.desktop
Of course, change the name, exec and icon lines to match each folder you wish to set up.

I have used thunar here as the default Xfce file manager. Bear in mind, thunar is limited from the command line so these directories will open in a new window regardless of a thunar instance already running, so another file manager may be necessary if you want finer control over this.

Now simply create another application menu item on your panel and point it to the custom-directories menu.

Cheers.

Offline

#6 2014-07-17 09:58:22

Padfoot
Member
Registered: 2010-09-03
Posts: 381

Re: [SOLVED] XFCE customize menu help: applications and directory menu

Lastly, to round out the subject, if you really want to get into generating custom menus for all sorts of things have a look at the following:

http://www.freedesktop.org/wiki/Specifi … menu-spec/
http://www.freedesktop.org/wiki/Specifi … ntry-spec/

Xfce honours the freedesktop menu and desktop entry specs so understanding the docs above will open up all sorts of menu tricks you can achieve.

I, for example, have separated my games out of the main menu into a separate menu with Steam listed at the top and all games below, then a single subsection for all my emulator games - gens, dosbox, pcsx, mame, vice etc. I also have a quicklaunch menu for my most frequently used applications - all remaining applications are still accessed through a modified default menu which just removes generic items I never use.

Cheers.

Offline

#7 2014-07-18 23:24:59

ConnorBehan
Package Maintainer (PM)
From: Long Island NY
Registered: 2007-07-05
Posts: 1,359
Website

Re: [SOLVED] XFCE customize menu help: applications and directory menu

Thanks, I didn't know about "<All />".


6EA3 F3F3 B908 2632 A9CB E931 D53A 0445 B47A 0DAB
Great things come in tar.xz packages.

Offline

#8 2014-07-31 02:01:44

heyitstallchris
Member
Registered: 2013-10-01
Posts: 23

Re: [SOLVED] XFCE customize menu help: applications and directory menu

Excellent help. Resourceful for others.

Marked as solved.

Offline

#9 2017-01-01 13:43:19

nsklaus
Member
Registered: 2017-01-01
Posts: 6

Re: [SOLVED] XFCE customize menu help: applications and directory menu

@ConnorBehan
thanks for your post, explaining how simply create a custom menu, by ditching the <category> and all the unnecessary things. i have found it can be simplified a little bit more by avoiding to declare each entry two times, and still keep the correct order defined in <layout>.

<Menu>
    <!--find *.desktop files-->
    <DefaultAppDirs />
    <DefaultDirectoryDirs/> 

    <Include>
        <All/>
    </Include>

    <Layout>
        <Filename>sublime_text.desktop</Filename>
        <Filename>xfce-settings-manager.desktop</Filename>
        <Filename>exo-web-browser.desktop</Filename>
        <Filename>exo-terminal-emulator.desktop</Filename>
        ....
    </Layout>
</menu>

Offline

#10 2017-01-01 14:35:59

WorMzy
Administrator
From: Scotland
Registered: 2010-06-16
Posts: 12,411
Website

Re: [SOLVED] XFCE customize menu help: applications and directory menu

Please don't necrobump, nsklaus.

https://wiki.archlinux.org/index.php/Co … bumping.22

Closing.


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

Board footer

Powered by FluxBB