joseluis / huion-linux-drivers

Linux user-space drivers for Huion Graphic Tablets
MIT License
168 stars 95 forks source link

Won't hold down a key (only single click) #85

Open Combinacijus opened 4 years ago

Combinacijus commented 4 years ago

For example when I map shift to a button (for resizing brush in Krita) it won't work because it only clicks once and do not hold. This happens because how python script call xdotool key instead of xdotool keydown (sequence come from config file) here: https://github.com/joseluis/huion-linux-drivers/blob/763e5da2533f1e57b642b2987fe57c19f9dd8d6a/huion-tablet-driver.py#L498 when config looks like this:

[menu_4b_simple]
b0 = key ctrl+z        # undo (krita)
b1 = key shift          # resize brush (krita)
...

Workaround In config change key to keydown for button which need hold

[menu_4b_simple]
b0 = key ctrl+z          # undo (krita)
b1 = keydown shift   # resize brush (krita)
...

But now it won't release so we need to modify driver to release that button in this case shift (couldn't find a general solution). I did it by calling xdotool keyup in this case using keypress function gives same result. So I added else statement for this if: https://github.com/joseluis/huion-linux-drivers/blob/763e5da2533f1e57b642b2987fe57c19f9dd8d6a/huion-tablet-driver.py#L389

if BUTTON_VAL > 0:  # 0 means release
  # Unchanged
   ...
else:
   # HERE RELEASE ALL KEYS
   keypress("Shift up", "keyup shift")