Running a script from an icon
From OESF
This explains how to run a script from a tab icon in Qtopia that either launches a background process or a graphical application along with some other commands.
To launch a script in the terminal from an icon, please see ScriptToLaunchConsoleApps
To setup a script and icon to launch it, follow the steps below:
- First create the script with your favourite editor and save it under /home/QtPalmtop/bin (It must be saved or linked to from here)
- Make the script executable:
cd /home/QtPalmtop/bin chmod a+x myscript.sh
- Create an icon to run it. This can be done in one of two ways:
- If you have the Sharp SL-5000D 1.x ROM or Sharp SL-5500 2.x ROM then install Tab Manager. If you have a later Sharp ROM (or derived ROM) or later Zaurus model, then use the Tab Settings program. When you create a new icon with either of these apps, only give the script filename as the executable and NOT the entire path. So if your script is called 'myscript.sh' then only enter 'myscript.sh' in the executable box.
- You can create a desktop icon file manually with your favourite text editor. Create a new file under the sub-directory under /home/QtPalmtop/apps that matches the tab you want the icon to appear on. The filename must end in '.desktop' and contain the following:
- If you have the Sharp SL-5000D 1.x ROM or Sharp SL-5500 2.x ROM then install Tab Manager. If you have a later Sharp ROM (or derived ROM) or later Zaurus model, then use the Tab Settings program. When you create a new icon with either of these apps, only give the script filename as the executable and NOT the entire path. So if your script is called 'myscript.sh' then only enter 'myscript.sh' in the executable box.
[Desktop Entry] Comment = This is my script Exec = myscript.sh Icon = myicon Name = My Script Type = Application
The Type value is fixed, but all the other values can be changed to whatever you want. The Icon value is the name of an icon PNG file under /home/QtPalmtop/pics without the '.png. extension. Again, do not put the full path in for the Exec value. When you create the .desktop file manually you must restart Qtopia to get it to show.
Tapping the icon should run your script.
If you are launching a graphical application with your script, it will not get an icon on the taskbar when it loads due to the way Qtopia associates icons with processes.
Qtopia will also not signal when the script has finished so there is nothing wrong if the exploded overlay on the icon does not go away.

