Help - Search - Members - Calendar
Full Version: Mapping A Keystroke To Qcop Commands
OESF Forums > Distros, Development, and Model Specific Forums > Everything Development > Qt/Qtopia
Snappy
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?
tml
QUOTE(Snappy @ Jan 31 2007, 04:11 PM)
F26 = @qcop QPE/System 'execute(QString)' ime.sh


Make sure there is a tab after the @qcop (not a blank).
Snappy
QUOTE(tml @ Jan 31 2007, 10:18 PM)
QUOTE(Snappy @ Jan 31 2007, 04:11 PM)
F26 = @qcop QPE/System 'execute(QString)' ime.sh


Make sure there is a tab after the @qcop (not a blank).
*



Gee, thanks! That works brilliantly! Who would have guessed that!! biggrin.gif
Snappy
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
#!/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
tml
QUOTE(Snappy @ Jan 31 2007, 06:26 PM)
hmmm ... strangely, it seem to work, as in it blanks the screen but does not do anything.
[/code]
*


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.
Snappy
QUOTE(tml @ Feb 1 2007, 03:37 AM)
QUOTE(Snappy @ Jan 31 2007, 06:26 PM)
hmmm ... strangely, it seem to work, as in it blanks the screen but does not do anything.
[/code]
*


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.
*



I see ... hmmm ... is there maybe a way for keyhelper app to run a .sh script directly?
Meanie
QUOTE(Snappy @ Feb 1 2007, 02:26 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
#!/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

*


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()'"
Snappy
QUOTE(Meanie @ Feb 1 2007, 11:49 AM)
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()'"
*


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.
bam
try creating an icon that calls the script then call the icon of the script via qcop channel
Snappy
QUOTE(bam @ Feb 1 2007, 12:38 PM)
try creating an icon that calls the script then call the icon of the script via qcop channel
*


hmmm ... sounds like a plan! smile.gif
Snappy
ok, so far seems to work ... smile.gif ... but takes like 3 seconds to do it! ohmy.gif

Thanks all for the input and suggestions! biggrin.gif
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?
Meanie
QUOTE(Snappy @ Feb 1 2007, 03:30 PM)
ok, so far seems to work ... smile.gif ... but takes like 3 seconds to do it! ohmy.gif

Thanks all for the input and suggestions! biggrin.gif
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?
*


of course you can. my zgcc image supports both qte and xqt
Snappy
QUOTE(Meanie @ Feb 1 2007, 01:34 PM)
QUOTE(Snappy @ Feb 1 2007, 03:30 PM)
ok, so far seems to work ... smile.gif ... but takes like 3 seconds to do it! ohmy.gif

Thanks all for the input and suggestions! biggrin.gif
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?
*


of course you can. my zgcc image supports both qte and xqt
*



Roger that, thanks! smile.gif
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2014 Invision Power Services, Inc.