1

I'm running Ubuntu 14.04 LTS. I use a program called ApE (A plasmid Editor) which I have to run directly from the Terminal using the following command;

tclsh8.5 /home/justin/ApE/AppMain.tcl 

For convenience, I would like to be able to open this program directly as an executable icon embedded in the Launcher. My expectation is that there should be a simple bash script I could write to call tclsh8.5 to open the .tcl file directly, but I am a complete novice and have no idea how to proceed towards this end. Any help would be greatly appreciated.

  • @dobey I'm pretty sure my default desktop environment is Unity, and all the answers on that thread deal with GNOME. Should I install the GNOME environment, or press on with the Unity? – KurtKlystron Oct 02 '15 at 22:25
  • The launchers are placed in the same location, using the same format, for either Unity, GNOME, or KDE. – dobey Oct 03 '15 at 12:37

1 Answers1

0

Here is the complete process of what I ended up doing;

$ sudo apt-get install gksu
$ cd /usr/share/applications
$ gksudo gedit ApE.desktop

Then I made the following .desktop file

[Desktop Entry]
Type=Application
Name=ApE
Icon=/home/justin/ApE/ApE.png
Exec=/home/justin/ApE/AppMain.tcl %f
Version=1.0
Comment=A Plasmid Editor
GenericName=Plamid Editor
Terminal=false
X-MultipleArgs=false
Categories=Utility;
StartupWMClass=ApE
StartupNotify=true

From there, I needed to modify the .tcl file by adding the following shebang to that script;

#!/usr/bin/tclsh

Then I made the .tcl script executable;

$ cd /home/justin/ApE
$ chmod +x AppMain.tcl

Then I validated and installed the .desktop with the following commands;

$ cd /usr/share/applications
$ desktop-file-validate ApE.desktop
$ desktop-file-install ApE.desktop

The desktop-file-install command added the following line to the .desktop file;

X-Desktop-File-Install-Version=0.22

Then I needed to do a simple drag-and-drop of the ApE icon in the /usr/share/applications directory to the Unity Launcher, and there it was.

However, while this placed the ApE icon in the launcher, whenever I clicked the ApE icon, it created a question mark icon in the launcher to represent the open window. To alleviate this, I needed to make the StartupWMClass values in agreement. So back in terminal, I ran the following command;

$ xprop WM_CLASS

and then clicked on the open ApE window, which returned the following output;

WM_CLASS(STRING) = "dna_window18", "Toplevel"

So I went back into the ApE.desktop file;

$ cd /usr/share/applications
$ gksudo gedit ApE.desktop

and changed the StartupWMClass value to Toplevel, giving a final ApE.desktop file of

[Desktop Entry]
Type=Application
Name=ApE
Icon=/home/justin/ApE/ApE.png
Exec=/home/justin/ApE/AppMain.tcl %f
Version=1.0
Comment=A Plasmid Editor
GenericName=Plamid Editor
Terminal=false
X-MultipleArgs=false
Categories=Utility;
StartupWMClass=Toplevel
StartupNotify=true
X-Desktop-File-Install-Version=0.22

And that fixed it completely.