Print this article Edit this article

Adding Menus to the Linux Desktop

Overview

Providing menu based application launching capability on Linux allows users to more naturally interact with the operating system in a graphical environment. This document describes the steps used to add menu entries to the system menu under Linux (Gnome and KDE).  The procedure documented here is not for applications that are packaged with ECN's local packaging system (based on the Solaris packaging system).  For adding menus to those applications see Hints for Creating and Installing UNIX Software.

The menu system is maintained by IGOR through a set of configuration files and scripts that create the Linux system files needed for displaying menus and linking them to executable programs. Menus created by this procedure will appear in either 'ECN Applications' or '<site> Site Applications' submenus within the Linux system menu.  <site> will be the individual site designator e.g. 'AAE', 'ECE', 'ME', etc.
 

Adding a Menu Entry

The file to edit when adding a menu entry is maintained by igor and must be changed by editing the igor master file.  The file is sitemenu.conf.

To add a menu, simply add a configuration line to sitemenu.conf.  When the igor maintenance script is run, sitemenu.conf will be updated and all appropriate menu files will be created.  All local menu files are created in /usr/local/share/applications.  Files in this directory with the extension .desktop are processed and, conditionally, used to create menu entries.  A category tag (see below) within the file determines which hosts will display the menu entries.  The site categories are based on the site designators with a special case for menus that appear on all ECN hosts.

Configuration Lines

Each menu requires a configuration line.  The format of that line is as follows:

MENU_NAME;EXECUTABLE_FILE[;USE_TERMINAL[;ICON_FILE]]

Each field is separated by a semicolon.  Malformed configuration lines will be flagged and ignored by the menu building script.

MENU_NAME is the label that will appear on the menu button and should be descriptive of the application being launched.

EXECUTABLE_FILE is the application to be launched.  This may be either a program in the search path or an absolute path to the executable file.  An absolute path is preferable since the search path of the user is not predictable.

USE_TERMINAL is optional and defaults to 'False'.  It should be 'True' only if the application requires a terminal window (e.g. Pine).

ICON_FILE is also optional and designates an absolute path to a file containing an icon to be displayed on the menu button with MENU_NAME.  If an icon file is used, the USE_TERMINAL field is required since the parameters are positional.  A null USE_TERMINAL may be designated by ";;" (default to 'False')

Category Tags

The category tags are site designators and are enclosed in square brackets [].  Configuration lines following a tag will create .desktop files that contain the appropriate tag for that site.  A category ends when another category tag is encountered.  Most hosts will only use two category tags, 'ALL' and <site> where <site> is the site designator.  The default igor configuration file restricts site category tags to hosts within a site.

[NOTE: If a category tag appears more than once in a host's sitemenu.conf file, only menus after the last tag will appear on the host]

Sample sitemenu.conf file (already processed by igor)

# Comments begin with '#', blank lines are ignored

[ALL]
# List of applications for 'ECN Applications' submenu
MATLAB;/usr/opt/bin/matlab;False

# Pine requires a terminal window
PINE;/usr/local/bin/pine;True

# This file was processed for an ecnsite host so only menus for this site will appear
# in the 'ECN Site Applications' submenu

[ECN]
# USE_TERMINAL will default to 'False' since it is null in this entry
# This menu button will include the icon 'sysinfo-icon-48x48.png'
Sysinfo;/usr/local/bin/mcsysinfo;;/opt/sysinfo/8/lib/icons/Tk/sysinfo-icon-48x48.png

 

Last Modified: Dec 19, 2016 11:12 am US/Eastern
Created: Mar 23, 2010 10:54 am GMT-4 by admin
JumpURL: