OESF Portables Forum

Everything Else => Zaurus - Everything Development => Distros, Development, and Model Specific Forums => Archived Forums => Qt/Qtopia => Topic started by: Snappy on January 31, 2007, 09:11:53 am

Title: Mapping A Keystroke To Qcop Commands
Post by: Snappy on January 31, 2007, 09:11:53 am
I've written a small script for toggling the input panel. (ime.sh)
It runs fine and now I'm trying to bind a keystroke to call it.

In keyhelper.conf, I added an additional line as follows

Quote
...
[Launch]
...
F26 = @qcop QPE/System 'execute(QString)' ime.sh
...

When I press Home+FirstJapKey (the one next to Ctrl), nothing happens. If I bind it as below, it calls up zeditor successfully.

Quote
...
[Launch]
...
F26 = Applications/zeditor
...

Anyone have any idea what is wrong with my call?
Title: Mapping A Keystroke To Qcop Commands
Post by: tml on January 31, 2007, 09:18:41 am
Quote
F26 = @qcop QPE/System 'execute(QString)' ime.sh

Make sure there is a tab after the @qcop (not a blank).
Title: Mapping A Keystroke To Qcop Commands
Post by: Snappy on January 31, 2007, 09:52:31 am
Quote
Quote
F26 = @qcop QPE/System 'execute(QString)' ime.sh

Make sure there is a tab after the @qcop (not a blank).
[div align=\"right\"][a href=\"index.php?act=findpost&pid=153030\"][{POST_SNAPBACK}][/a][/div]

Gee, thanks! That works brilliantly! Who would have guessed that!!
Title: Mapping A Keystroke To Qcop Commands
Post by: Snappy on January 31, 2007, 11:26:15 am
hmmm ... strangely, it seem to work, as in it blanks the screen but does not do anything.
Occassionally, home+key do not work altogether.

btw, my script ime.sh is as below
(I created a empty file at /home/tmp/ime_off)
Code: [Select]
#!/bin/sh
if [ -f /home/tmp/ime_on ]; then
    qcop    QPE/TaskBar 'hideInputMethod()'
    mv /home/tmp/ime_on /home/tmp/ime_off
else
    qcop    QPE/TaskBar 'showInputMethod()'
    mv /home/tmp/ime_off /home/tmp/ime_on
fi
Title: Mapping A Keystroke To Qcop Commands
Post by: tml on January 31, 2007, 02:37:24 pm
Quote
hmmm ... strangely, it seem to work, as in it blanks the screen but does not do anything.
[/code]
[div align=\"right\"][a href=\"index.php?act=findpost&pid=153039\"][{POST_SNAPBACK}][/a][/div]

It probably tries to change resolution or so. The execute command tries to start a qpe qpe application which a sh script is not, I think. I'd say you'd have to wrap the script into something qtopian but maybe there's a simpler solution.
Title: Mapping A Keystroke To Qcop Commands
Post by: Snappy on January 31, 2007, 02:48:56 pm
Quote
Quote
hmmm ... strangely, it seem to work, as in it blanks the screen but does not do anything.
[/code]
[div align=\"right\"][a href=\"index.php?act=findpost&pid=153039\"][{POST_SNAPBACK}][/a][/div]

It probably tries to change resolution or so. The execute command tries to start a qpe qpe application which a sh script is not, I think. I'd say you'd have to wrap the script into something qtopian but maybe there's a simpler solution.
[div align=\"right\"][a href=\"index.php?act=findpost&pid=153065\"][{POST_SNAPBACK}][/a][/div]

I see ... hmmm ... is there maybe a way for keyhelper app to run a .sh script directly?
Title: Mapping A Keystroke To Qcop Commands
Post by: Meanie on January 31, 2007, 10:49:56 pm
Quote
hmmm ... strangely, it seem to work, as in it blanks the screen but does not do anything.
Occassionally, home+key do not work altogether.

btw, my script ime.sh is as below
(I created a empty file at /home/tmp/ime_off)
Code: [Select]
#!/bin/sh
if [ -f /home/tmp/ime_on ]; then
    qcop    QPE/TaskBar 'hideInputMethod()'
    mv /home/tmp/ime_on /home/tmp/ime_off
else
    qcop    QPE/TaskBar 'showInputMethod()'
    mv /home/tmp/ime_off /home/tmp/ime_on
fi
[div align=\"right\"][a href=\"index.php?act=findpost&pid=153039\"][{POST_SNAPBACK}][/a][/div]

your qcop commands need to run as the zaurus user. maybe your script is called as root user.
try something like

su zaurus -c    "qcop   QPE/TaskBar 'hideInputMethod()'"
Title: Mapping A Keystroke To Qcop Commands
Post by: Snappy on January 31, 2007, 11:35:52 pm
Quote
your qcop commands need to run as the zaurus user. maybe your script is called as root user.
try something like

su zaurus -c  "qcop   QPE/TaskBar 'hideInputMethod()'"
[div align=\"right\"][a href=\"index.php?act=findpost&pid=153134\"][{POST_SNAPBACK}][/a][/div]

ok, modified as per above, still shows a black blank screen and returns after awhile without toggling input panel.

Further, running the script from konsole causing the script to ask for password.
Title: Mapping A Keystroke To Qcop Commands
Post by: bam on January 31, 2007, 11:38:53 pm
try creating an icon that calls the script then call the icon of the script via qcop channel
Title: Mapping A Keystroke To Qcop Commands
Post by: Snappy on February 01, 2007, 12:15:59 am
Quote
try creating an icon that calls the script then call the icon of the script via qcop channel
[div align=\"right\"][a href=\"index.php?act=findpost&pid=153140\"][{POST_SNAPBACK}][/a][/div]

hmmm ... sounds like a plan!
Title: Mapping A Keystroke To Qcop Commands
Post by: Snappy on February 01, 2007, 12:30:06 am
ok, so far seems to work ...  ... but takes like 3 seconds to do it!

Thanks all for the input and suggestions!
Once I get to my notebook, I'll write a C app to do it properly. My only hurdle is compiling for Z ... something I haven't come up to speed.

btw, meanie, can I gcc natively using gcc from pdaXqtrom?
Title: Mapping A Keystroke To Qcop Commands
Post by: Meanie on February 01, 2007, 12:34:20 am
Quote
ok, so far seems to work ...  ... but takes like 3 seconds to do it!

Thanks all for the input and suggestions!
Once I get to my notebook, I'll write a C app to do it properly. My only hurdle is compiling for Z ... something I haven't come up to speed.

btw, meanie, can I gcc natively using gcc from pdaXqtrom?
[div align=\"right\"][a href=\"index.php?act=findpost&pid=153153\"][{POST_SNAPBACK}][/a][/div]

of course you can. my zgcc image supports both qte and xqt
Title: Mapping A Keystroke To Qcop Commands
Post by: Snappy on February 01, 2007, 06:10:07 pm
Quote
Quote
ok, so far seems to work ...  ... but takes like 3 seconds to do it!

Thanks all for the input and suggestions!
Once I get to my notebook, I'll write a C app to do it properly. My only hurdle is compiling for Z ... something I haven't come up to speed.

btw, meanie, can I gcc natively using gcc from pdaXqtrom?
[div align=\"right\"][a href=\"index.php?act=findpost&pid=153153\"][{POST_SNAPBACK}][/a][/div]

of course you can. my zgcc image supports both qte and xqt
[div align=\"right\"][a href=\"index.php?act=findpost&pid=153154\"][{POST_SNAPBACK}][/a][/div]

Roger that, thanks!