Gum-Joe / 2Keys

A easy to setup second keyboard, designed for everyone.
GNU General Public License v3.0
11 stars 4 forks source link

Add support for the detection of media keys #32

Open Gum-Joe opened 5 years ago

Gum-Joe commented 5 years ago

Up until now, I thought media keys weren't supported by 2Keys, as practical testing showed they weren't detected. However, as it turns out, media keys are logged to a separate file in /dev/input:

$ ls /dev/input/by-id/ 
usb-Logitech_Gaming_Keyboard_G810_166A37573236-event-if01
usb-Logitech_Gaming_Keyboard_G810_166A37573236-event-kbd
usb-Logitech_Gaming_Keyboard_G810_166A37573236-if01-event-kbd

The 2nd one in the list is what 2Keys watches, and this doesn't show any media keys. However, if we watch the first file, the media keys show up (but none of the other keys like the letters, Ctrl, etc)

Implementing this may be a challenge since 2 'keyboards' now have to be watched. Approaches include:

  1. Async python, which is a pain error handling wise
  2. Run 2 2Keys detectors (little worried about CPU usage with many keyboards)
  3. Multithreading (don't know how to do this in Python)

Will likely require #5 to be completed first.