3

I want to launch a script (that ultimately launches an editor) with a single click in GNOME 2. To this end I have a script which sources the environment variables first and then ultimately launches the editor. The script looks something like:

#!/bin/sh
source variablesFile
editor $1

From the terminal I can easily launch the editor with:

$ ~/script myFile.txt 

Now, what I want to achieve is have an icon in the taskbar/Desktop, from which I can double click and start typing, just like gedit.

I tried the following way:

enter image description here

but it did not work (mostly because the environment variables could not be changed).

I also tried:

enter image description here

but a terminal window flashed and went away. No idea what happened. Any clues?

1 Answer 1

0

We need to launch a terminal (here xterm), and run the script (which launches the editor) as an argument to it. Later we can shortcut the launchScript into the Gnome shortcut.

The launch script looks like:

#!/bin/sh
xterm -e /path/to/editor/launch/script.sh

Now we point the shortcut to this file: enter image description here

This retains the values of environment variables, as we are running a script from a terminal.

Note: In this approach the xterm window vanishes, as soon as the editor is launched. To hold this window, use the following command: xterm -hold -e /path/to/editor/launch/script.sh .

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .