Menu

Home

Narnie Harshoe

Version=0.1.3+alpha

Introduction

There have been many times where I have found that for some reason or another, a graphical program I have installed does not have a menu item with it. I delved into how menu items get placed, and found out it is by a .desktop file located in a certain folder(s). When there, the menu system automatically reads it and puts the program where it belongs in the menu system.

I have had this issue installing some Windows programs with Wine, but it has cropped up at other times, too.

I had written myself a little bash script that lets me easily created these specially formatted .desktop files, but thought it might be nice to create a GUI for this for those who don't prefer the command line. Easing the task for the user, I thought it would be nice to automatically save it to the correct location.

Hence Create Launcher was born.

Why Create Launcher and not Create Menu Item? Because, all a menu item is is a launcher placed in a specific folder which is read according to the Desktop Menu Specification and the menu structure is created. This makes it easy to add and remove menu items almost automatically.

Language and Utilities

Create Launcher is written in Python 2.7.2+ on a Linux Mint Debian Edition desktop tracking the straight Debian Testing repository. I'm using Glade 3.10.2 for some interface design which means I needed to learn GTK3 (I have previously only worked with GTK2), which hasn't been too painful. I am finding Glade 3.10.2 to be a little buggy with some crashes and limitations (it only supports the new Gtk.Box, no VBox or HBox support and it only supports the new Gtk.Grid, not Gtk.Table, et. al.).

Why not go to Python 3? Well, I didn't know how full the support for GTK3 is in Python 3. With introspection, it is probably pretty good for the core. I have written the code in a way that should make upgrading to Python 3 pretty easy when I feel comfortable with the support. Python 2.7 is the last major code base for the Python 2.x era, so things should move a lot faster as the developers start devoting their time to Python 3 (both Python 3 core developers and 3rd party Python developers).

I have recently started learning vim, so much of the development process has also been tweaking vim to my liking and learning it. So far, I'm hooked on vim. I really like it over my previous use of a highly modified gEdit and Geany.

Requirements

I have discovered that GTK3+ for python (python-gi) is not available on current Ubuntu systems except for the release candidates of 12.04. However, python-gobjects IS available which provides python-gi. I am investigating the ability to install python-gi, which is required for this software on earlier systems. As of right now, these are the requirements on a system to run Create Launcher (which are available on systems tracking Debian lenny through testing on and Ubuntu based systems from Maveric 10.10 on):

  • python-gi (the python bindings for the GObjects introspection library to access GTK3+) introspection data for GLib, GObject, Gio and GModule

or

  • python-gobject (the same)

The following are requirements for python-gi:

  • libc0.1 (>= 2.3) [kfreebsd-amd64, kfreebsd-i386] Embedded GNU C Library: Shared libraries; also a virtual package provided by libc0.1-udeb
  • libc6 (>= 2.13) [s390x] Embedded GNU C Library: Shared libraries; also a virtual package provided by libc6-udeb
  • libc6 (>= 2.2.5) [amd64]
  • libc6 (>= 2.3.6-6~) [i386]
  • libc6 (>= 2.4) [armel, armhf, mips, mipsel, powerpc, s390]
  • libc6 (>= 2.6) [sparc]
  • libc6.1 (>= 2.2) [ia64] Embedded GNU C Library: Shared libraries; also a virtual package provided by libc6.1-udeb
  • libffi5 (>= 3.0.10-3) [kfreebsd-amd64, kfreebsd-i386] Foreign Function Interface library runtime
  • libffi5 (>= 3.0.4) [not armel, armhf, kfreebsd-amd64, kfreebsd-i386]
  • libffi5 (>= 3.0.9) [armel, armhf]
  • libgirepository-1.0-1 (>= 1.29.0) Library for handling GObject introspection data (runtime library)
  • libglib2.0-0 (>= 2.28.0) GLib library of C routines
  • python (<< 2.8) interactive high-level object-oriented language (default version)
  • python (>= 2.6.6-7~)
  • python2.7 An interactive high-level object-oriented language (version 2.7)
    or
  • python2.6 An interactive high-level object-oriented language (version 2.6)

Installation

As of now, a deb package has been created. Download it from Downloads or by clicking



Install it using your graphical deb install (e.g. gdebi-gtk) or by running this (for sudo based distros) in a terminal like:

$ sudo dpkg -i create-launcher*.deb

For distros that do not use sudo, do

$ su root

and login as root, then do:

# dpkg -i create-launcher*.deb

For rpm based distros, download the rpm from Downloads and install it following your distr's instruction.

Also, I have a tarball uploaded, and those who know what to do with it and how to install such into the system (or more safely, a subdirectory in their home) can play around with it if desired.

I know how to roll deb packages (I'm not an expert, but I can get by and pass lintian checks), and will set this up once I have the program in a working alpha state. I don't know anything about building rpms (and have little desire to learn, honestly), but I'll use alien to make an RPM package available that you can try (at your own risk).

Running

If installed using the deb, there should be a launcher shortcut in the menu system. On a "start button" type menu system, it should be under Utility. Using the new Gnome 3 interface, just start typing in "create" and it should come up.

If running from the command line, type:

$ create-launcher

If installed from a tarball opening into a user directory, run it by:

[directory it was opened into]/create_launcher/create-launcher-0.1.3+alpha/usr/share/create-launcher/bin/create_launcher.py

Usage

Below is an example of the main window.

main window

There are three types of launchers planned for this project (and in the Desktop Entry Specification) that will eventually be supported.

  1. Applications
  2. Links
  3. Directories

The initial release will only support creating Application .desktop files, hopefully with Links following soon thereafter.

As you can see from the main window, it is relatively straight forward. All text fields and the categories field need filled out. The terminal and autostart field are options.

Begin with filling out the Executable Location field. This can be hand-entered, or the icon can be clicked. As of this version, the full, absolute path needs to be filled out and will be checked for an existing file at that location. In future releases, I hope to also include the ability to search the system environment's path variable allowing it to search the path for an executable with that name.

Next, fill out the Icon Location field. As of this time, I have it set up with a requirement to have an icon. It needs the full path at this time as well. I will be placing a default icon location conform to the specification. As with the executable location, the location can be hand-entered of the icon clicked and a file chooser will appear.

The terminal and autostart fields are options.

Give the program the name you want to appear in the menu system in the Program Name field.

Give a comment for the program in the Comment Text field.

Click on the Categories Select Categories button, which will bring a popup window from which you can select one or more categories as you can see in the image below:

categories window

Finally, decide if you want the program to be run from a terminal (useful for terminal/command line based programs or when wanting to see any standard output or standard error message from the program). Check it if you want it run in a terminal. Leave it unchecked if you want it run without the terminal

When you are done entering, you need to decide if you want the .desktop file saved in the user menu system (~/.local/share/application/) or saved in the system's menu making it available to everyone (/usr/share/applications). A third alternative is to have is saved in a custom location. It will default to ~/.config/autostart. If it is saved in this location and the Autostart toggle is checked, then the program will start when your desktop environment starts up. If it is unticked, then it will not start. As of this first implementation, saving to a root location will be disabled (or non-functional).

On this pre-alpha version, opening a .desktop file is disabled as this is not implemented yet. Selecting a type other then Application is also disabled. These will be implemented as the features are developed.

Troubleshooting

If you have any trouble running the program, first, please run it in a shell (command line). In the Gnome desktop environment, run Xterm or gnome-terminal (often just called Terminal on menues). On KDE, run Konsole.

From the command window, run:

$ /usr/share/create-launcher/bin/create_launcher.py

Watching for any error messages.

Please report problems on the Tickets and/or the Forum

Future Plans

I hope to continue work on the project to implementing the following features (likely in this order):

  1. Opening a .desktop file
  2. Creating a Link .desktop file
  3. Creating a Directory .desktop file
  4. Write a manpage

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.