Linux utility to create custom key bindings for the Huion Kamvas Pro (2019), Inspiroy Q620M, and potentially other tablets.
xdo_build.py
script. It should create a file named _xdo_cffi.cpython-...-linux-gnu.so
.huion_keys.py
. It will create an example config file at ~/.config/huion_keys.conf
.Install the udev rules to set up permissions for the tablet. This program
can generate the udev rules for you, so you can do something like:
python huion_keys.py --rules > /etc/udev/rules.d/50-huion-tablet.rules
Alternatively, you can run huion_keys.py
as root or give yourself read permission for your tablet's hidraw file. For example:
chmod o+r /dev/hidraw3
The first time you start this program, it will create an example config file at ~/.config/huion_keys.conf
. The configuration file is in INI format that has, at minimum, a [Bindings]
section.
Each button is numbered, so assigning button 3 to be "ctrl+z" looks like this:
[Bindings]
3=ctrl+z
The keys need to be in a format understood by xdotool, so look at xdotool's documentation for more details. There's also this handy list of key codes that may be helpful.
Normal key bindings are pressed and released immediately once you push down the button. If you need the keys to be held down for as long as you hold the button down, put its binding in the [Hold]
section instead. This is useful for modifier keys such as the Control key.
[Hold]
4=ctrl
The scroll strip and rotating dial can be configured with the following button names:
scroll_up
and scroll_down
dial_cw
and dial_ccw
You can configure alternative bindings as separate "modes". For example, you can configure the dial knob to adjust brush size in one mode and zoom in a different mode. A separate button needs to be configured to switch to the next mode. Here's an example that uses button 9 to switch modes:
[Mode 1]
dial_cw=bracketright
dial_ccw=bracketleft
[Mode 2]
dial_cw=ctrl+shift+equal
dial_ccw=ctrl+minus
[Dial]
cycle=9
It works by listening on the tablet's hidraw interface for button presses and sending key events to X using xdotool.
I'm not sure what other Huion tablets it works for, but you can open a Github issue if you have a Huion tablet and would like to help add support for it.
The general process for adding a new tablet is:
get_tablet_hidraw()
.For example, on a Dvorak layout, this application may report that it sent "F" but it actually results in a "Y" keypress.
As a workaround, try running setxkbmap
without any arguments before running
this program.