Script To Launch Console Apps

From OESF

Jump to: navigation, search

There are three ways of launching console applications in the terminal from a tab icon:

The simpler way

Install the latest version on Embedded Konsole and create a script in /home/!QtPalmtop/bin that looks something like this:

#!/bin/sh
qcop QPE/Application/embeddedkonsole 'setDocument(QString)' 'your_command'

Replace 'your_command' with the command you want to run, keeping the quotes.

Make it executable with the command:

chmod a+x /home/!QtPalmtop/bin/your_script

Then create a tab icon to run your script, either with the Tab Settings application or by hand.

By hand, create the file /home/!QtPalmtop/apps/Applications/your_app.desktop, that contains:

[Desktop Entry]
Exec=your_script
Icon=whatever.png
Type=Application
Name=your_app
!CanFastload=0

Then restart Qtopia.

The slightly more complicated way

Quoted from Stmpynode on the old ZaurusZone forums: (added a little formatting)

"i got embeddedkonsole to run an app from qtopia.

here's how i did it.

the first thing is to make sure you have a .bashrc in your /home/root directory. i symlinked .profile to .bashrc

the very last line of .bashrc is exec $RUNME

now i created a bash script to invoke from the qtopia:

/usr/local/bin/irk
#!/bin/bash
export RUNME=ks
embeddedkonsole
export RUNME=""

then the

/usr/local/bin/ks
#!/bin/bash
TERM=linux
export TERM
cd /home/root/kismet
kismet_monitor -H & kismet
cd  ~

and last but no least i created

/home/!QtPalmtop/apps/Applications/kismet.desktop
[Desktop Entry]
Exec=irk
Icon=warn
Type=Application
Name=Kismet
CanFastload=0

now when i click on the kismet icon i get a terminal with kismet in color ready to go"

The more flexible way

To make it so that you can tap a script in the Document/Files tab and it will launch in the terminal, follow the instructions below:

1) Install the latest version of Embedded Konsole%%% 2) Edit the file /home/!QtPalmtop/etc/mime.types and if it does not have an entry for "application/x-sh" then add the following line

application/x-sh      sh

3) Edit the Embedded Konsole desktop icon file, which is usually /home/!QtPalmtop/apps/Applications/embeddedkonsole.desktop, and add the following lines:

!MimeType = application/x-sh
!MimeTypeIcons = konsole/Terminal

4) Restart Qtopia 5) Create a shell script anywhere where it will be visible on the Documents/Files tab, give the it the filename extension '.sh', and make sure it is executable with the command:

chmod a+x myscript.sh

Then when you tap the script file in the Documents/Files tab it will launch within the Konsole application. It is important that you give the script file a '.sh' filename extension as that is how it is associated with the Mime Type application/x-sh and that in turn is associated with the Embedded Konsole application.

Personal tools