Adding Entries to AfterStep Menus
Introduction
This article is a tutorial for adding entries to the AfterStep (AS) Menu through the use of Desktop Entry Files. Users can add unlimited items to the AS Menu by creating simple text files and placing them in the $HOME (~/.afterstep) directory. A user can add entries for applications that don't have a menu entry, or entries can be added to enhance or extend existing applications. This tutorial gives a brief description of Desktop Entry Files, examples of these files, and the parameters within the files.
Desktop Entry Files
Desktop Entry Files contain a descriptive application name, the category that the application can be grouped with, and other useful information used by a desktop to handle the application. These files, provided by most Linux distributions, are usually located in /usr/share/applications/ (Fedora and Unbuntu) and end with the extension ".desktop". Both the GNOME and KDE desktop environments use Desktop Entry Files to create menu entries. AS uses these files and adds additional entries for useful and legacy applications; the AS entries are located (depending upon distribution) in:
/usr/share/afterstep/applications or /usr/local/share/afterstep/applications
In addition, and most importantly for the user, entries can be added to a user's home directory via the folder:
~/.afterstep/applications
Ensure that any added Entry Files end with the .desktop extension.
Entry Examples
Desktop Entry Files are simple text files with "Keys" that provide information about the application; under AS, these files can be individually listed (as are those provided with distributions) or grouped together within one file. The entry "system.desktop", currently found in /usr/share/afterstep/applications, is an example of multiple Desktop Entries included in one file. The following is an abbreviated example of this file:
[Desktop Entry] Name=System Info GenericName=System Info Comment=Display Linux kernel parameters in graphical form Exec=xsysinfo Icon=normal/Wrench Terminal=false Type=Application Encoding=UTF-8 Categories=System TryExec=xsysinfo [Desktop Entry] Name=System Load GenericName=System Load Comment=System load average display for X Exec=xload Icon=normal/Wrench Terminal=false Type=Application Encoding=UTF-8 Categories=System TryExec=xload [Desktop Entry] Name=CPU Process List GenericName=Top CPU Processes Comment=Display top CPU processes Exec=top Icon=normal/Wrench Terminal=true Type=Application Encoding=UTF-8 Categories=System TryExec=top
Look in /usr/share/afterstep/applications for examples of Entry Files. Please note that although the entries (files) in that directory were grouped according to "Categories", the entries do not actually need to follow a particular grouping; i.e., you can have a monolithic .desktop file with multiple entries and multiple categories.
Entry Parameters
Include all Keys as shown in the example. Using the first preceding Entry example, let's look at the Entry Keys for "System Info":
[Desktop Entry] Name=System Info GenericName=System Info Comment=Display Linux kernel parameters in graphical form Exec=xsysinfo Icon=normal/Wrench Terminal=false Type=Application Encoding=UTF-8 Categories=System TryExec=xsysinfo
Name - Required. Ensure that it's unique and not the same as any other entry; this is the only Key that requires uniqueness. It doesn't actually need to reflect the name of the application.
GenericName - Not used for Menu, but included for completeness. Match to Name.
Comment - Planned for use in Menu (tooltips). Please include. The NAME line from man pages or Summary line from RPM packages is a good reference.
Exec - this is the binary or script used to launch the application. Include options and flags as you would from a command-line.
Icon - Many icons to choose from AS, or the system. For AS icons, include the subdirectory that the icon is in, i.e. normal/icon-name, logo/icon-name. There are also icons under /usr/share/icons and /usr/share/pixmaps. Do not include the subdirectory path, just use the icon name. You can usually exclude the icon extension. (.png, .xpm, etc.). You are also able to use custom icons in the HOME AS dir, ~/.afterstep/desktop/icons.
Terminal - true or false. If it needs a terminal to display, then true.
Type - For AS, this will always be Application.
Encoding - UTF-8 works fine.
TryExec - Checks for a listed binary or file; if the file isn't available, AS tags it as "unavailable" and it's either ghosted or not shown in Menu. Not actually required, but nice to have if the application may not be available. Distribution package applications don't need this: the Entry is part of the package and removed with the package.
Categories - This tells AS where to "group" the Entry. The following Sub-Menu folders contain and correspond to the listed AS-valid Categories:
Applications/ - TerminalEmulator Applications/Accessories - Utility Applications/Development - Development Applications/Games - Game Applications/Graphics - Graphics Applications/Educational - Education, Science, Engineering, Teaching Applications/Emulators - Emulator Applications/Multimedia - AudioVideo Applications/Network - Network Applications/Office - Office Applications/System - System Applications/Text Editors - TextEditor System Settings/ - SystemSetup, Settings
Conclusion
Adding entries to the AfterStep Menu is simple, straightforward, and increases the usability of an already fantastic window manager. Under AS, Desktop Entry Files provide flexibility and greatly enhance desktop function.