Under Linux these are called launchers. It took a little while for me to spot this and I was trying to make these the hard way. But Ubuntu’s right click menu on the desktop has a ‘create launcher’ option and that pretty much does it. You get to pick an application type, name it and put in a command. Simple. Well, not quite.
It is simple if you are just trying to run something like an executable which will pop up its own window and let you drive it. I wanted to run a build script and have it wait when it finished so I could see what happened.
The last bit is really important because builds often fail and it is, obviously, a waste of time to go test against a build that did not make it.
I googled and found various advice but none of it quite worked for me, though it did for other people. Here is what I ended up doing:
The command is
gnome-terminal –window-with-profile=”keep” -e “/home/roger/project/buildscripts/publish\_framework.sh”
People suggested xterm instead of gnome-terminal but that did not work for me. Another thing that did not work was using $HOME instead of the full path. But the command is only half the story.
If you open up a terminal (and this is, of course, a gnome-terminal) there is a menu along the top of the window (no, I never noticed it before either). Use the Edit menu to open up the profiles dialog and create a new profile. I called mine ‘keep’. Now edit the profile and look under the ‘Title and Command’ tab. There’s a setting for ‘When command exits’ and I picked ‘Hold the terminal open’.
This means that the terminal window doesn’t just close, it waits there until I close it manually.
Some people suggested using the ‘read’ command to make the terminal wait, and that would save messing about with these profiles and settings. I gather read works like pause under windows. Except that it didn’t for me, so I’m going with this approach.
Now I have my build script on a desktop icon just as I wanted and I can see how it finished.
You might wonder why I don’t just launch the build from Eclipse. It is just an ant script and Eclipse is good at that. Well, normally I do but this particular project was put together by people who didn’t know that and some of the decisions they made were a little strange. Some things you have to just live with, but a decent shortcut (sorry, launcher) to the build script makes it easier.