How to add a submenu to the menu in linux

Last year I posted how-to-run-programs-over-secure-shell, in which I described how to add a menu entry to the menu. In that example I used the Network catorgory. Which is ok for one or two , however if you have more then one program you wish to run and/or more then one server it could make the network submenu look untidy. Because of this I thought I would share how to create another submenu for ssh programs. This is easily achieved by created two files and depending on whether or not your wanting to create this menu for just one user or all users.

The first file is a .menu and can be anything. Since this is for ssh I’m going to call it ssh.menu and should be saved to should be saved as ~/.config/menus/applications-merged/ssh.menu for a single user and /etc/xdg/menus/applications-merged/ssh.menu for all users. This file should look like,

<!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
  "http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd">
<Menu> 
  <Name>ssh</Name>
   <Menu>
       <Name>ssh</Name>
       <Directory>ssh.directory</Directory>
       <Include>
	    <Category>ssh</Category> 
       </Include>
       <Layout>
            <Merge type="all"/>
       </Layout>
   </Menu>
</Menu>

The second file is a .directory and since its already been referenced as ssh.directory it needs to match that. This file needs to be saved as ~/.local/share/desktop-directories/ssh.directory for a single user and /usr/share/desktop-directories/ssh.directory for all users. This file should be look like,

[Desktop Entry]
Version=1.0
Name=ssh
Icon=network
Type=Directory

Each user still needs to create their own .desktop files for their programs running over ssh. These files are saved in ~/.local/share/applications/ Each .desktop file should look something like this example for mousepad,
[Desktop Entry]
Encoding=UTF-8
Version=1.0
Name=Mousepad on Server
Type=Application
Exec=ssh -X user@ip.address “mousepad”
Icon=network
Categories=ssh

This is what it looks like in the xfce menu it should be the same in other desktop menus aswell however I haven’t test that. Please feel free to do so and let me know. 2

Advertisements
Posted in 01Ben, Applications, Computers, General, Ideas, Interesting, Linux, Linux Wiki
One comment on “How to add a submenu to the menu in linux
  1. […] my last post I posted how to add a menu globally I thought that would make a good example of how to make a […]

Please feel free to leave a reply.

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Archives
Categories

Enter your email address to follow this blog and receive notifications of new posts by email.

Join 69 other followers

%d bloggers like this: