Xfce Forum

Sub domains
 

You are not logged in.

#1 2018-11-14 15:24:25

CwF
Member
Registered: 2018-01-28
Posts: 287

SOLVED:Applications Menu tweaking

For the Applications Menu panel add on I copied the default menu for use as the custom menu choice. This works fine. I reordered and condensed it some exploring how it works.

I'd like it to have more than one layer deep, that is using the carrot to the right to expand into a sub-menu. I can only get the first  and secongd layers, as the original menu does. Can there be more nesting for 3+ layes deep? I can't get anything to work.

As the default right click bring up its top level, application has a carrot to expand its sub-menu on layer/level 2, then the categories and the sub menu settings for example carrot out to layer 3.

Starting at the application menu  as layer 1 I tried to move much to a new and existing submenu 'personal'.

    <Menu>
        <Name>Personal</Name>
        <DefaultAppDirs />
        <Directory>xfce-personal.directory</Directory>
         <Include>
          <ALL/>
         </Include>
        <Layout>
         <Filename>xfce4-run.desktop</Filename>
            <Menuname>Accessories</Menuname>
            <Separator/>
            <Menuname>Development</Menuname>
            <Separator/>
            <Menuname>Education</Menuname>
            <Separator/>
            <Menuname>Graphics</Menuname>
            <Separator/>
            <Menuname>Multimedia</Menuname>
            <Separator/>
            <Menuname>Network</Menuname>
            <Separator/>
            <Menuname>Office</Menuname>
            <Separator/>
            <Menuname>Other</Menuname>
        </Layout>
    </Menu>

With the Layout section included the line remains blank. If I remove the Layout section then everything is thrown in like I'd expect.
The top level includes this and it works fine.

    <Layout>
        <Filename>xfce4-run.desktop</Filename>
        <Separator/>
        <Filename>exo-terminal-emulator.desktop</Filename>
        <Separator/>
        <Menuname>Personal</Menuname>
        <Separator/>
        <Menuname>Games</Menuname>
        <Separator/>
        <Menuname>Settings</Menuname>
        <Separator/>
        <Menuname>System</Menuname>
        <Separator/>

    </Layout>

Basically, is there a limit to nesting menus?

Last edited by CwF (2018-11-15 01:04:20)

Offline

#2 2018-11-14 17:36:54

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 10,949

Re: SOLVED:Applications Menu tweaking

I don't believe there is any limit on nesting. It's hard to tell what you've done. As I test, I created a 4 layer deep menu structure. Here is what I did.

  1. In ~/.config/menus/xfce-application.menu, I added the following substructure:

    	<Menu>
    		<Name>Layer 2</Name>
    		<Directory>layer2.directory</Directory>
    		<Include>
    			<Category>Layer2</Category>
    		</Include>
    
    		<Menu>
    			<Name>Layer 3</Name>
    			<Directory>layer3.directory</Directory>
    			<Include>
    				<Category>Layer3</Category>
    			</Include>
    
    			<Menu>
    				<Name>Layer 4</Name>
    				<Directory>layer4.directory</Directory>
    				<Include>
    					<Category>Layer4</Category>
    				</Include>
    			</Menu>
    		</Menu>
    	</Menu>

    .

  2. Then I created the necessary .directory files in ~/.local/share/desktop-directories using the following template:

    [Desktop Entry]
    Name=Layer 2
    Comment=Layer 2
    Icon=
    Type=Directory

    .

  3. Then I created the required .desktop files in ~/.local/share/applications (using Atril.desktop as the base) and the following template:

    [Desktop Entry]
    Name=Layer 2 App
    GenericName=Layer 2 App
    Comment=Layer 2 App
    TryExec=atril
    Exec=atril %U
    StartupNotify=true
    Terminal=false
    Type=Application
    Icon=atril
    Categories=Layer2;GTK;Office;Viewer;

End result:
menu.png


Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki  |  Community | Contribute ---

Offline

#3 2018-11-14 18:58:18

CwF
Member
Registered: 2018-01-28
Posts: 287

Re: SOLVED:Applications Menu tweaking

Excellent, thank you for the clear example.
However, I wanted to pull in the <Menuname>menus</Menuname> references that were originally in the top layer and simply merged, into the second layer. As in your example, referencing a desktop or directory file, new or existing, does work. The method of Layout with the Menuname and separator tags doesn't work, so far..

So the extent of how I edited the original from /etc/xdg/menus/ is to add the pasted section referencing an existing directory file. In this section as shown I added the Menuname tag for each menu defined in the default file. I did not create any desktop or directory files. Using existing references it is really just a shuffle to a second layer, I thought...
I think I see how it could work from your example with more rework of the file and more specific listings. I was thinking my reshuffle mod would benefit from the parsing ability already in the default file.?

It would be like in your example you took one of the existing categories, and its menu, as shown as any of the peers to layer 2, and move it to layer3 or 4. Itemized references work yes, but not the layout and menu tag. Hope I'm explaining clear..

Offline

#4 2018-11-14 21:45:48

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 10,949

Re: SOLVED:Applications Menu tweaking

If I understand correctly, the items in the layout section are tied to the upper level via the "XFCE;X-Xfce-TopLevel" category parameters. Removing them as well as adding a new category entry for the destination layer results in the following:
Untitled.png

Here is the relevant entry from the menu file:

	<Menu>
		<Name>Layer 2</Name>
		<Directory>layer2.directory</Directory>
		<Include>
			<Category>Layer2</Category>
		</Include>

		<Menu>
			<Name>Layer 3</Name>
			<Directory>layer3.directory</Directory>
			<Include>
				<Category>Layer3</Category>
			</Include>

			<Menu>
				<Name>Layer 4</Name>
				<Directory>layer4.directory</Directory>
				<Include>
					<Category>Layer4</Category>
				</Include>
				<Layout>
				        <Filename>exo-terminal-emulator.desktop</Filename>
				        <Filename>exo-file-manager.desktop</Filename>
					<Separator/>
					<Filename>exo-mail-reader.desktop</Filename>
					<Filename>exo-web-browser.desktop</Filename>
				        <Merge type="all"/>
				</Layout>
			</Menu>
		</Menu>
	</Menu>

...and the change to the .desktop file:

[Desktop Entry]
Version=1.0
Type=Application
Exec=exo-open --launch TerminalEmulator
Icon=utilities-terminal
StartupNotify=true
Terminal=false
Categories=Layer4;Utility;
OnlyShowIn=XFCE;
X-AppStream-Ignore=True
Name=Terminal Emulator

(I copied the exo-* files to ~/.local/share/applications and edited them there. They will supersede the ones in /usr/share/applications)


Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki  |  Community | Contribute ---

Offline

#5 2018-11-15 01:03:19

CwF
Member
Registered: 2018-01-28
Posts: 287

Re: SOLVED:Applications Menu tweaking

Ongoing thanks!

I got it to work like I wanted.
Some summary;         <Category>X-Xfce-Toplevel</Category> does need to be there, and at least one desktop file needs mentioned under Layout. Without either of those and the entry stays blank. Furthermore, all the menus, now submenus need to included in between the parent menu tags, in the menu that calls them in Layout. Originally they were list after the 'Personal' end /Menu. Confusing...

Anyway, this should drop in and work as a custom menu for 'Applications Menu' on a panel with no other files needed.

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

<Menu>
    <Name>focus.menu</Name>

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

    <Include>
        <Category>X-Xfce-Toplevel</Category>        
    </Include>

    <Layout>
        <Filename>exo-terminal-emulator.desktop</Filename>
        <Separator/>
        <Menuname>Personal</Menuname>
        <Separator/>
        <Menuname>Games</Menuname>
        <Separator/>
        <Menuname>Settings</Menuname>
        <Separator/>
        <Menuname>System</Menuname>
        <Separator/>

    </Layout>

    <Menu>
        <Name>Personal</Name>
        <DefaultAppDirs />
        <Directory>xfce-personal.directory</Directory>
    <Include>
        <Category>X-Xfce-Toplevel</Category>
    </Include>

    <Layout>
        <Filename>xfce4-run.desktop</Filename>
        <Separator/>
            <Menuname>Accessories</Menuname>
            <Separator/>
            <Menuname>Development</Menuname>
            <Separator/>
            <Menuname>Education</Menuname>
            <Separator/>
            <Menuname>Graphics</Menuname>
            <Separator/>
            <Menuname>Multimedia</Menuname>
            <Separator/>
            <Menuname>Network</Menuname>
            <Separator/>
            <Menuname>Office</Menuname>
            <Separator/>
            <Menuname>Other</Menuname>
    </Layout>
    <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>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>Other</Name>
        <Directory>xfce-other.directory</Directory>
        <OnlyUnallocated/>
        <Include>
            <All/>
        </Include>
    </Menu>

    </Menu>

    <Menu>
        <Name>Games</Name>
        <Directory>xfce-games.directory</Directory>
        <Include>
            <Category>Game</Category>
        </Include>
    </Menu>
    <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>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>

Last edited by CwF (2018-11-15 01:29:46)

Offline

#6 2018-11-15 01:16:43

MountainDewManiac
Member
From: Where Mr. Bankruptcy is Prez
Registered: 2013-03-24
Posts: 1,115

Re: SOLVED:Applications Menu tweaking

[co de]Text in a code box[/co de]
(Remove spaces.)

Regards,
MDM


Mountain Dew Maniac

How to Ask for Help <=== Click on this link

Offline

#7 2018-11-15 01:20:49

CwF
Member
Registered: 2018-01-28
Posts: 287

Re: SOLVED:Applications Menu tweaking

I owe MountainDewManiac a Big Gulp

Offline

#8 2018-11-15 12:47:24

MountainDewManiac
Member
From: Where Mr. Bankruptcy is Prez
Registered: 2013-03-24
Posts: 1,115

Re: SOLVED:Applications Menu tweaking

Not at all (although I'll equate that offer with a "thank you" - and accept a sandwich if you ever come to my town wink . So... You're welcome.

I'll even offer you a big tip, if you promise not to feel (too) silly when you read it:

Ready, lol?

Okay, then, here you go:

Look below the message reply box. See that bit that states "BBCode: on" down there? Left-click on it wink .

Regards,
MDM


Mountain Dew Maniac

How to Ask for Help <=== Click on this link

Offline

Board footer

Powered by FluxBB