Kodi Community Forum

Full Version: Addon that gets keypresses and doesn't pass them to kodi
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I'm doing a script addon that translates keypresses from a RF remote (seen by kodi as a regular keyboard) to serial commands. My plan is to relay them to an arduino to send custom IR commands to different devices, thus converting my RF remote into a programmable IR remote à la Harmony.

I copied Keymap Editor's idea of creating a WindowXML and doing action.getButtonCode() in doAction() to get the key code. I start the addon with a key via custom shortcut, send IR commands while it's running, exit with another key. It works great.

The thing is, the keypresses are passed down to kodi too. For example, if I press 's' while the addon is running, the power off dialog appears behind the window addon and I have to close it afterwards (and I may exit accidentally).

Is there any way to capture keypresses and don't relay them to the underlying kodi? (I've noticed that Keymap Editor has the same problem, so I don't know if it's possible to intercept the key presses completely.)