2021-04-16 14:38:33 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
|
|
for i in $(seq 10); do
|
|
|
|
|
if xsetwacom list devices | grep -q Wacom; then
|
|
|
|
|
break
|
|
|
|
|
fi
|
|
|
|
|
sleep 1
|
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
list=$(xsetwacom list devices)
|
2021-11-01 23:02:14 +00:00
|
|
|
column=$((echo "$list" | grep "\(WL\)" >/dev/null) && echo 9 || echo 8)
|
|
|
|
|
pad=$(echo "${list}" | awk "/pad/{print \$$column}")
|
|
|
|
|
stylus=$(echo "${list}" | awk "/stylus/{print \$$column}")
|
|
|
|
|
eraser=$(echo "${list}" | awk "/eraser/{print \$$column}")
|
2021-04-16 14:38:33 +01:00
|
|
|
|
|
|
|
|
if [ -z "${pad}" ]; then
|
|
|
|
|
exit 0
|
|
|
|
|
fi
|
|
|
|
|
|
2021-08-23 23:25:59 +01:00
|
|
|
first_display="$(xrandr | grep -oP "([^\s]+)(?=\sconnected)" | head -1)"
|
2021-04-16 14:38:33 +01:00
|
|
|
|
2021-08-23 23:25:59 +01:00
|
|
|
xsetwacom set "${stylus}" MapToOutput "${first_display}"
|
|
|
|
|
xsetwacom set "${eraser}" MapToOutput "${first_display}"
|
|
|
|
|
|
|
|
|
|
first_resolution="$(xrandr | grep -oP "(\d+x\d+)(?=[^*]+\*)" | head -1)"
|
|
|
|
|
IFS='x'
|
|
|
|
|
read -ra resolution <<< "$first_resolution"
|
|
|
|
|
|
|
|
|
|
width=31496
|
|
|
|
|
height="$(bc -l <<< "ratio=${resolution[0]}/${resolution[1]}; scale=0; $width/ratio")"
|
|
|
|
|
|
|
|
|
|
xsetwacom set "${stylus}" Area "0 0 $width $height"
|
|
|
|
|
xsetwacom set "${eraser}" Area "0 0 $width $height"
|
2021-04-16 14:38:33 +01:00
|
|
|
|
|
|
|
|
xsetwacom set "${pad}" Button 11 "key +ctrl z -ctrl"
|
|
|
|
|
xsetwacom set "${pad}" Button 10 "key +shift"
|
|
|
|
|
xsetwacom set "${pad}" Button 9 "key +ctrl"
|
|
|
|
|
xsetwacom set "${pad}" Button 1 "button +15"
|
|
|
|
|
#xsetwacom set "${pad}" Button 4 "key 0xffad"
|
|
|
|
|
#xsetwacom set "${pad}" Button 4 "button +5"
|