Skip to content

Instantly share code, notes, and snippets.

@Caffe1neAdd1ct
Created July 8, 2020 22:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Caffe1neAdd1ct/4e1c31bf83a8a2bacea45cc61b4749e5 to your computer and use it in GitHub Desktop.
Save Caffe1neAdd1ct/4e1c31bf83a8a2bacea45cc61b4749e5 to your computer and use it in GitHub Desktop.
HUION INSPIROY Q11K V2 startup script
#!/bin/sh
#Set to specific monitor name, based on the output from command: xrandr
MONITOR="DP-1"
PAD_NAME='HUION Huion Tablet Pad pad'
STYLUS_NAME='HUION Huion Tablet Pen stylus'
# Get all device IDs for the PAD_NAME - in case multiples are present for wired and wireless connections
padIDs=$(xinput --list | awk -v search="$PAD_NAME" \
'$0 ~ search {match($0, /id=[0-9]+/);\
if (RSTART) \
print substr($0, RSTART+3, RLENGTH-3)\
}'\
)
# Ensure all buttons set for mulitple devices with the same name - handles wired and wireless tablet connections
for i in $padIDs
do
echo Processing ID: $i
#select sculptDraw brush
xsetwacom --set $i Button 1 "key x"
#select smooth brush
xsetwacom --set $i Button 2 "key s"
#select crease brush
xsetwacom --set $i Button 3 "key shift c"
#select pinch brush
xsetwacom --set $i Button 8 "key p"
#select clay strip brush
xsetwacom --set $i Button 9 "key 3"
#select flatten brush
xsetwacom --set $i Button 10 "key shift t"
#select grab brush
xsetwacom --set $i Button 11 "key 9"
#select mask brush
xsetwacom --set $i Button 12 "key m"
#select snake hook brush -Only have 8 keys
#xsetwacom --set $i Button 1 "key k"
done
# Get all device IDs for the STYLUS_NAME - in case multiples are present for wired and wireless connections
stylusIDs=$(xinput --list | awk -v search="$STYLUS_NAME" \
'$0 ~ search {match($0, /id=[0-9]+/);\
if (RSTART) \
print substr($0, RSTART+3, RLENGTH-3)\
}'\
)
# Map all stylus input devices to the preferred single screen - in case multiples are present for wired and wireless connections
for j in $stylusIDs
do
echo Processing ID: $j
xinput map-to-output $j $MONITOR
done
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment