This release is a pre-release and may not be stable for production use.
Hotkeys PHAL plugin
This plugin maps keyboard hotkeys to OVOS bus events. You define key combinations, and the plugin sends the matching bus event when you press or release the keys.
Install
Add your user to the tty and input groups.
sudo usermod -a -G tty,input $USER
You can find more information in this issue.
Then install the plugin.
pip install ovos-PHAL-plugin-hotkeys
Configuration
Add a bus message and a key combo under "key_down" or "key_up".
Use "key_down" to react when a key is pressed. Use "key_up" to react when a key is released.
Here is a complete example based on events from a generic G20 USB remote.
"PHAL": {
"ovos-PHAL-plugin-hotkeys": {
"debug": false,
"key_down": {
"mycroft.mic.listen": 582,
"mycroft.mic.mute.toggle": 190,
"mycroft.mic.mute": "shift+m",
"mycroft.mic.unmute": "shift+u",
"mycroft.volume.increase": 115,
"mycroft.volume.decrease": 114,
"mycroft.volume.mute.toggle": 113,
"mycroft.volume.mute": "ctrl+shift+m",
"mycroft.volume.unmute": "ctrl+shift+u",
"homescreen.manager.show_active": 144,
"ovos.common_play.play_pause": 164
}
}
}
For the Mark2 drivers, you can find the emitted key events in the sj201-buttons-overlay.dts file.
"PHAL": {
"ovos-PHAL-plugin-hotkeys": {
"key_down": {
"mycroft.mic.listen": 582,
"mycroft.mic.mute": 248,
"mycroft.volume.increase": 115,
"mycroft.volume.decrease": 114
},
"key_up": {
"mycroft.mic.unmute": 248
}
}
}
gpios 22-24 are the momentary switches. gpio 25 is MuteMic SW, connected to 3.3v or GND.
Finding keys
You can find a list of valid key scancodes here.
Some key presses are not detected correctly and show up as "unknown". Some devices also emit the wrong keycodes.
In this case, enable the debug flag in the config, then check the logs.
DEBUG {"event_type": "down", "scan_code": 57, "name": "space", "time": 1711050758.24674, "device": "/dev/input/event4", "is_keypad": false, "modifiers": []}
DEBUG {"event_type": "down", "scan_code": 24, "name": "o", "time": 1711050758.510758, "device": "/dev/input/event4", "is_keypad": false, "modifiers": []}
DEBUG {"event_type": "down", "scan_code": 115, "name": "unknown", "time": 1711050858.940323, "device": "/dev/input/event3", "is_keypad": false, "modifiers": []}
DEBUG {"event_type": "down", "scan_code": 114, "name": "unknown", "time": 1711050864.262953, "device": "/dev/input/event3", "is_keypad": false, "modifiers": []}
Use the scan_code integer in your config instead of the name string.
Credits
- Keyboard handling comes from the boppreh/keyboard package.
License
This plugin is available under the Apache-2.0 license.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ovos_phal_plugin_hotkeys-0.1.3a2.tar.gz.
File metadata
- Download URL: ovos_phal_plugin_hotkeys-0.1.3a2.tar.gz
- Upload date:
- Size: 69.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
30c22dd5a79908bdd71bbb620945e45f140a469e9cfe0eb176cf24ee856993fb
|
|
| MD5 |
a9dbe1bc0d1da2071b863605c88c8513
|
|
| BLAKE2b-256 |
d686003aa6740a590dffcc01a0f8daec1e4cd94c9024fbe9c238636a4773c6d0
|
File details
Details for the file ovos_phal_plugin_hotkeys-0.1.3a2-py3-none-any.whl.
File metadata
- Download URL: ovos_phal_plugin_hotkeys-0.1.3a2-py3-none-any.whl
- Upload date:
- Size: 72.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
96906b5ef8b5ce52c52d3a2110e55dd5fd842d554ea65b37ca08fac0d06671b8
|
|
| MD5 |
222c5c3e83d88dfe796a0407d709755e
|
|
| BLAKE2b-256 |
41d43b58badcc544dc9d3ecda0da91c0deeea2e7f42c447950ae96cb77375c19
|