Hi!
It's possible to simulate an alt-tab key event?
how?
I saw in the ati-mplayer.py that some keystrokes are mapped to many key button strings; this is the correct way?
and also (OT): what if I've 3 applications running (mythwelcome, mythfrontend, freevo)? there is any way to bring in foreground a specific app?
thank you,
orangeek
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
This presses down the ALT button, then clicks the TAB key, then depresses the ALT button. With upcoming Gizmod 3.2 (and SVN) you just need to do the following:
nor of the both methods work here (v3.3 via svn).
with the first method (alt-tab) I get
Traceback (most recent call last):
File "/usr/local/etc/gizmod/GizmodDispatcher.py", line 109, in onEvent
if UserScript.onEvent(Event, Gizmo):
File "/usr/local/etc/gizmod/modules.d/400-ATIX10-MythTV.py", line 171, in onEvent
GizmoScriptActiveApplication.onEvent(self, Event, Gizmo)
File "/usr/local/etc/gizmod/modules.d/bases/GizmoScriptActiveApplication.py", line 65, in onEvent
return self.onDeviceEvent(Event, Gizmo)
File "/usr/local/etc/gizmod/modules.d/400-ATIX10-MythTV.py", line 74, in onDeviceEvent
Gizmod.Keyboards[0].createEvent(GizmoEventType.EV_KEY, GizmoKey.KEY_TAB,[GizmoKey.KEY_ALT])
AttributeError: type object 'GizmoDaemon.GizmoKey' has no attribute 'KEY_ALT'
Failed to call GizmodDispatcher.onEvent for deserializeMessage
and with the second method (setinputfocus for xterm) it didnt work.
I noticed also that running gizmod -V 5 the program is not in debug mode...
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
with LEFTALT it works!
[I've yet to check how come back to the original app after the first alt-tab, perhaps modifiyng the default script and not the mythtv one].
with setinputfocus simply don't work! I get no error and nothing changes on screen.
this is the part of my mythtv py script
Hmmm... so right now how it works is if you pass in "xterm" it'll look for the first window with "xterm" in the title. For me, when I start an xterm there is never "xterm" in the title. However if I set it to the title of the xterm window ("user@hostname") it works properly.
Perhaps what would be more useful is setting the active application by window class rather window title?
At any rate can you verify that "xterm" (case sensitive) is in the window title? If not, try playing with it to see if it really is non-functional.
Thanks!
Tim.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
mmmmh, I can't get it working.
gizmod 0.33, launched with gizmod -g -C /usr/local/etc/gizmod/
relevant part of 400-ati-myth.py
elif Event.Code == GizmoKey.KEY_A:
Gizmod.setInputFocus("xterm")
return True
elif Event.Code == GizmoKey.KEY_B:
Gizmod.setInputFocus("mythfrontend")
return True
mythfrontend running under windowmaker and the window has focus. an xterm is launched with title xterm [checking with gizmod debug : onEvent: WindowFocus [FocusIn] -- <WindowTitle:xterm> <FormalName:xterm> <Class:XTerm>]
output of A button pressed [it should focus xterm]
onEvent: ATIX10 -- /dev/input/event4 | [EV_KEY] <KEY_A> c: 0x1e v: 0x1
I also tried bringing in front mythwelcome: same output from gizmod and same (no)change on screen.
The config files in the dir are the default ones.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hmm... okay I'm gonna have to do some more investigating. I'll try duplicating your setup (with WindowMaker and all) this weekend and see if I can figure anything out.
Tim.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
well,I don't know if I do something wrong... normally to test the software (or a feature of) I renamed my .gizmod dir and I use the default script.
A suggestion (no idea if possible): with the alt-tab key we've the problem that if 2+ applications are running you can't choose the application to bring in front.
the problem seems solved with the setinput command, but the downside is that you've to set a button for every application is running (one to bring in front freevo, one for mythfrontend, one for amarok, etc etc).
Using the normal alt-tab keyoboard shortcut is that if you keep pressed the alt-tab buttons, than using the tab button once (and with alt pressed) you can choose which app bring in front.
how is possible (or implementable) with gizmod?
my .2 cents :)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I think I see what you mean... you want to keep pressing tab while the alt key is pressed?
No problem.
There's a few ways this could be done -- you could map one button to alt (press once for turn alt on, press again for turn alt off), and another button to tab :).
If you're using the ATI class remotes I believe when you hold a key down the first button even gets value 1, and subsequent ones get value 2.
So what you could do is, on value 1 turn alt on, and press tab (createEventRaw(GizmoEventType.EV_KEY, GizmoKey.LEFTALT, 1) and createEvent(GizmoEventType.EV_KEY, GizmoKey.TAB), then on every value 2, send another tab event. Then on value 0 (when the button is depressed) turn off the alt button (createEventRaw(GizmoEventType.EV_KEY, GizmoKey.LEFTALT, 0).
LIRC remotes have a repeat value that can be checked to provide the same functionality. You could even skip every n repeat values (or value 2 button events) if the alt-tabbing goes too fast.
Another solution would be to use two button in the same way as the keyboard. Hold one on for alt, and map another one to tab. The alt button gets turned off when it's released.
When I get timer support in (hopefully this weekend) you should be able to check the duration of the events. So Press once and alt gets turned on, tab pressed. Each quick press of the button just fires a tab, then if you don't press it again for a while a timer times out and alt gets turned off.
What do you think?
Tim.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I think that, as usual, is great hint!
By now I would to use the setinputfocus with them I've problems and then I'll try to make the wmaker fonts (used in the menu of alt-tab) some bigger in order to follow your last suggestion: with the default fonts is pretty unreadable on my monitor!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
After some though I believe that in many situation Alt-Tab is likely a better solution than having a single button for every app you want to focus. Also, I can't seem to recreate your issue with setInputFocus (always works for me!?).
That being said, the new GizmodTimer class I put in allows for some nifty tricks, including proper Alt-Tabbing!
I created a script called modules.d/bases/GizmoScriptAltTabber.py that can be used to send Alt-Tab events with ease. I also included the ability into all of the remote device scripts (499*, and 599*).
The LIRC-MceUSB2 maps Alt-Tab to the "home" button.
The LIRC-Hauppauge maps Alt-Tab to the "Go" button.
The ATIX10 maps Alt-Tab to the "Bookmarks" button (looks like a book, near the top of the remote).
Each time you press the button it alt-tabs, and after a timeout period (default is 1.25 seconds -- the variable ALT_TAB_TIMEOUT is in GizmoDeviceStrings.py) is stops alt-tabbing.
Check it out and let me know what you think!
Tim.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi!
It's possible to simulate an alt-tab key event?
how?
I saw in the ati-mplayer.py that some keystrokes are mapped to many key button strings; this is the correct way?
and also (OT): what if I've 3 applications running (mythwelcome, mythfrontend, freevo)? there is any way to bring in foreground a specific app?
thank you,
orangeek
It sure is!
With Gizmod 3.1 you have to do the following:
Gizmod.Keyboards[0].createEvent(GizmoEventType.EV_KEY, GizmoKey.KEY_ALT, 1)
Gizmod.Keyboards[0].createEventPress(GizmoEventType.EV_KEY, GizmoKey.KEY_TAB)
Gizmod.Keyboards[0].createEvent(GizmoEventType.EV_KEY, GizmoKey.KEY_ALT, 0)
This presses down the ALT button, then clicks the TAB key, then depresses the ALT button. With upcoming Gizmod 3.2 (and SVN) you just need to do the following:
Gizmod.Keyboards[0].createEvent(GizmoEventType.EV_KEY, GizmoKey.KEY_TAB, [GizmoKey.KEY_ALT])
Currently no way to raise an app to foreground, although I've added this to the TODO list.
Tim.
thanks for the answer!
I'll try tonight (with the other suggestions in the 0.31 thread!).
orangeek
Application raising by window title is now supported in SVN via the command Gizmod.setInputFocus("WindowTitle")
When 3.2 is released this will be documented in the API docs, but I just wanted to give you a heads up.
goooood!
nor of the both methods work here (v3.3 via svn).
with the first method (alt-tab) I get
Traceback (most recent call last):
File "/usr/local/etc/gizmod/GizmodDispatcher.py", line 109, in onEvent
if UserScript.onEvent(Event, Gizmo):
File "/usr/local/etc/gizmod/modules.d/400-ATIX10-MythTV.py", line 171, in onEvent
GizmoScriptActiveApplication.onEvent(self, Event, Gizmo)
File "/usr/local/etc/gizmod/modules.d/bases/GizmoScriptActiveApplication.py", line 65, in onEvent
return self.onDeviceEvent(Event, Gizmo)
File "/usr/local/etc/gizmod/modules.d/400-ATIX10-MythTV.py", line 74, in onDeviceEvent
Gizmod.Keyboards[0].createEvent(GizmoEventType.EV_KEY, GizmoKey.KEY_TAB,[GizmoKey.KEY_ALT])
AttributeError: type object 'GizmoDaemon.GizmoKey' has no attribute 'KEY_ALT'
Failed to call GizmodDispatcher.onEvent for deserializeMessage
and with the second method (setinputfocus for xterm) it didnt work.
I noticed also that running gizmod -V 5 the program is not in debug mode...
Hey sorry, I must have told you how to do it wrong. There's not KEY_ALT -- need KEY_LEFTALT.
See the definitions here: http://gizmod.sourceforge.net/documentation/apidocs/a00343.html
Also what happened with setInputFocus?
Tim.
with LEFTALT it works!
[I've yet to check how come back to the original app after the first alt-tab, perhaps modifiyng the default script and not the mythtv one].
with setinputfocus simply don't work! I get no error and nothing changes on screen.
this is the part of my mythtv py script
elif Event.Code == GizmoKey.KEY_A:
Gizmod.setInputFocus("xterm")
return True
mythfrontend and xterm are running.
I press the A button and nothing change on screen.
Hmmm... so right now how it works is if you pass in "xterm" it'll look for the first window with "xterm" in the title. For me, when I start an xterm there is never "xterm" in the title. However if I set it to the title of the xterm window ("user@hostname") it works properly.
Perhaps what would be more useful is setting the active application by window class rather window title?
At any rate can you verify that "xterm" (case sensitive) is in the window title? If not, try playing with it to see if it really is non-functional.
Thanks!
Tim.
good hint!
I'll try tonight!
mmmmh, I can't get it working.
gizmod 0.33, launched with gizmod -g -C /usr/local/etc/gizmod/
relevant part of 400-ati-myth.py
elif Event.Code == GizmoKey.KEY_A:
Gizmod.setInputFocus("xterm")
return True
elif Event.Code == GizmoKey.KEY_B:
Gizmod.setInputFocus("mythfrontend")
return True
mythfrontend running under windowmaker and the window has focus. an xterm is launched with title xterm [checking with gizmod debug : onEvent: WindowFocus [FocusIn] -- <WindowTitle:xterm> <FormalName:xterm> <Class:XTerm>]
output of A button pressed [it should focus xterm]
onEvent: ATIX10 -- /dev/input/event4 | [EV_KEY] <KEY_A> c: 0x1e v: 0x1
I also tried bringing in front mythwelcome: same output from gizmod and same (no)change on screen.
The config files in the dir are the default ones.
Hmm... okay I'm gonna have to do some more investigating. I'll try duplicating your setup (with WindowMaker and all) this weekend and see if I can figure anything out.
Tim.
well,I don't know if I do something wrong... normally to test the software (or a feature of) I renamed my .gizmod dir and I use the default script.
A suggestion (no idea if possible): with the alt-tab key we've the problem that if 2+ applications are running you can't choose the application to bring in front.
the problem seems solved with the setinput command, but the downside is that you've to set a button for every application is running (one to bring in front freevo, one for mythfrontend, one for amarok, etc etc).
Using the normal alt-tab keyoboard shortcut is that if you keep pressed the alt-tab buttons, than using the tab button once (and with alt pressed) you can choose which app bring in front.
how is possible (or implementable) with gizmod?
my .2 cents :)
I think I see what you mean... you want to keep pressing tab while the alt key is pressed?
No problem.
There's a few ways this could be done -- you could map one button to alt (press once for turn alt on, press again for turn alt off), and another button to tab :).
If you're using the ATI class remotes I believe when you hold a key down the first button even gets value 1, and subsequent ones get value 2.
So what you could do is, on value 1 turn alt on, and press tab (createEventRaw(GizmoEventType.EV_KEY, GizmoKey.LEFTALT, 1) and createEvent(GizmoEventType.EV_KEY, GizmoKey.TAB), then on every value 2, send another tab event. Then on value 0 (when the button is depressed) turn off the alt button (createEventRaw(GizmoEventType.EV_KEY, GizmoKey.LEFTALT, 0).
LIRC remotes have a repeat value that can be checked to provide the same functionality. You could even skip every n repeat values (or value 2 button events) if the alt-tabbing goes too fast.
Another solution would be to use two button in the same way as the keyboard. Hold one on for alt, and map another one to tab. The alt button gets turned off when it's released.
When I get timer support in (hopefully this weekend) you should be able to check the duration of the events. So Press once and alt gets turned on, tab pressed. Each quick press of the button just fires a tab, then if you don't press it again for a while a timer times out and alt gets turned off.
What do you think?
Tim.
I think that, as usual, is great hint!
By now I would to use the setinputfocus with them I've problems and then I'll try to make the wmaker fonts (used in the menu of alt-tab) some bigger in order to follow your last suggestion: with the default fonts is pretty unreadable on my monitor!
After some though I believe that in many situation Alt-Tab is likely a better solution than having a single button for every app you want to focus. Also, I can't seem to recreate your issue with setInputFocus (always works for me!?).
That being said, the new GizmodTimer class I put in allows for some nifty tricks, including proper Alt-Tabbing!
I created a script called modules.d/bases/GizmoScriptAltTabber.py that can be used to send Alt-Tab events with ease. I also included the ability into all of the remote device scripts (499*, and 599*).
The LIRC-MceUSB2 maps Alt-Tab to the "home" button.
The LIRC-Hauppauge maps Alt-Tab to the "Go" button.
The ATIX10 maps Alt-Tab to the "Bookmarks" button (looks like a book, near the top of the remote).
Each time you press the button it alt-tabs, and after a timeout period (default is 1.25 seconds -- the variable ALT_TAB_TIMEOUT is in GizmoDeviceStrings.py) is stops alt-tabbing.
Check it out and let me know what you think!
Tim.
tomorrow I'll try it!