make initwacom more flexible
This commit is contained in:
@@ -16,11 +16,20 @@ if [ -z "${pad}" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
xsetwacom set "${stylus}" MapToOutput DisplayPort-1
|
||||
xsetwacom set "${eraser}" MapToOutput DisplayPort-1
|
||||
first_display="$(xrandr | grep -oP "([^\s]+)(?=\sconnected)" | head -1)"
|
||||
|
||||
xsetwacom set "${stylus}" Area "0 0 31496 17716"
|
||||
xsetwacom set "${eraser}" Area "0 0 31496 17716"
|
||||
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"
|
||||
|
||||
xsetwacom set "${pad}" Button 11 "key +ctrl z -ctrl"
|
||||
xsetwacom set "${pad}" Button 10 "key +shift"
|
||||
|
||||
Reference in New Issue
Block a user