Capture keys in windowless script
#1
Just wondering if its possible to capture key presses in a windowless script (ie. service). I would like to capture a key combination press and then popup a display. I did some searching but couldn't really find any examples.
Thanks.
Reply
#2
You can create a xbmcgui.WindowDialog instance without visual elements and reimplement onAction method.
But in any case you cannot capture key presses per se, only key/mouse/touch actions.
Reply
#3
Thank you. I will try that out.
Reply
#4
Unfortunately that suggestion doesn't quite work as the invisible modal dialog steals the focus.
Reply
#5
What key combination are you using, could you implement a custom keymap that runs your script when the correct key combination is pressed (although this would have to be restricted to a single key with an optional modifier)?
Reply
#6
Hadn't decided on the key combination yet. I was actually hoping to make it user selectable. In my case the script (service) is already running and want to monitor keypresses inside it to activate a popup (display sports scores).
Reply
#7
Does the service need to be running?

Could you use a custom keymap so that pressing S (or whatever key you choose) runs the script that displays your popup?
Reply

Logout Mark Read Team Forum Stats Members Help
Capture keys in windowless script0