1

I have a cheap xp-pen tablet with 8 extra buttons. I'd like to map them to keyboard shortcuts, such as Ctrl-Z, to use with Krita/Gimp/etc, but vendor's utility more looks as a proof-of-concept.

I also tried to use a EasyStroke as proposed here, but uh.

The pad recognized by xinput as a mouse with 12 buttons. My plan was:

  • remap tablet buttons to 100-107 as described there
  • capture events by xbindkeys
  • determinate current profile based on active window
  • simulate keystrokes by xev or xdotool
  • [extra] activate/deactivate this bicycle by udev rules or smth like

Everything works fine with simple cases, such as typing key number, but more complicated ones fails with "sticking" keys.

I uploaded my work into git repo. Default profile works fine with xdotool and xte variants, krita and gimp profiles doesn't work in both cases.

I logged events in handler.sh and discovered that xbindkeys "looses" some release events after krita or gimp profile execution, but works nice after default. I thought that this might be due to the execution of the handler for too long, and started it in a separate process, but this didn't change anything.

Well.. What could be the cause of this problem?

1 Answers1

1

The cause is pretty simple: according to gimp's profile, xev press control/shift buttons, and xbindkeys skips release event because shift is still pressed. You can duplicate each section of config to handle such situations, like this:

"/opt/xp-pen/handler.sh 1 1"
  b:100
"/opt/xp-pen/handler.sh 1 1"
  b:100 + shift
"/opt/xp-pen/handler.sh 1 1"
  b:100 + control
...