Update wacom draw area script

master
Hektor Misplon 2021-11-28 17:42:21 +01:00
parent 48ee2ca7fd
commit 45193f0f85
3 changed files with 85 additions and 26 deletions

84
.bin/set-wacom-draw-area Executable file
View File

@ -0,0 +1,84 @@
#!/usr/bin/env bash
# Note: this script gets called from $HOME/.config/autorandr/docked/postswitch,
# default drawing area on 4K monitor
# Centered draw area:
#
# x_offset = screen_width/2 - draw_width/2
# y_offset = screen_height/2 - draw_height/2
#
# Drawing area
#
w=1920 # Width
h=1080 # Height
x=1920 # Horizontal offset
y=1080 # Vertical offset
orientation="landscape" # Portrait/landscape
# Get screen resolution (TODO: test external monitor)
resolution=$(xrandr --current | grep "connected primary" | awk '{print $4}')
echo "$resolution"
# Get rotation setting
rotate=`[[ "$orientation" == "landscape" ]] && echo "half" || echo "ccw"`
#
# Wacom tablet
#
# Right bottom
xsetwacom set "Wacom Intuos Pro M Pen stylus" rotate "$rotate"
xsetwacom set "Wacom Intuos Pro M Finger touch" rotate "$rotate"
xsetwacom set "Wacom Intuos Pro M Pen eraser" rotate "$rotate"
xsetwacom set "Wacom Intuos Pro M Pen cursor" rotate "$rotate"
xsetwacom set "Wacom Intuos Pro M Pen stylus" rotate "$rotate"
xsetwacom set "Wacom Intuos Pro M Pen stylus" MapToOutput "$w"x"$h"+"$x"+"$y"
xsetwacom set "Wacom Intuos Pro M Finger touch" MapToOutput "$w"x"$h"+"$x"+"$y"
xsetwacom set "Wacom Intuos Pro M Pen eraser" MapToOutput "$w"x"$h"+"$x"+"$y"
xsetwacom set "Wacom Intuos Pro M Pen cursor" MapToOutput "$w"x"$h"+"$x"+"$y"
xsetwacom set "Wacom Intuos Pro M Pen stylus" MapToOutput "$w"x"$h"+"$x"+"$y"
# Centered
# xsetwacom set "Wacom Intuos Pro M Pen stylus" MapToOutput 1920x1080+"$(w/2)"+"$(h/2)"
# xsetwacom set "Wacom Intuos Pro M Finger touch" MapToOutput 1920x1080+"$(w/2)"+"$(h/2)"
# xsetwacom set "Wacom HID 5214 Pen stylus" MapToOutput 1920x1080+"$(w/2)"+"$(h/2)"
# xsetwacom set "Wacom HID 5214 Finger touch" MapToOutput 1920x1080+"$(w/2)"+"$(h/2)"
# xsetwacom set "Wacom Intuos Pro M Pen eraser" MapToOutput 1920x1080+"$(w/2)"+"$(h/2)"
# xsetwacom set "Wacom Intuos Pro M Pen cursor" MapToOutput 1920x1080+"$(w/2)"+"$(h/2)"
# xsetwacom set "Wacom HID 5214 Pen eraser" MapToOutput 1920x1080+"$(w/2)"+"$(h/2)"
# xsetwacom set "Wacom Intuos Pro M Pen stylus" MapToOutput 1920x1080+"$(w/2)"+"$(h/2)"
# # Rotate drawing are for vertical drawing
# # (physical controls above drawing area)
# xsetwacom set "Wacom Intuos Pro M Pen stylus" rotate ccw
# xsetwacom set "Wacom Intuos Pro M Finger touch" rotate ccw
# xsetwacom set "Wacom HID 5214 Pen stylus" rotate ccw
# xsetwacom set "Wacom HID 5214 Finger touch" rotate ccw
# xsetwacom set "Wacom Intuos Pro M Pen eraser" rotate ccw
# xsetwacom set "Wacom Intuos Pro M Pen cursor" rotate ccw
# xsetwacom set "Wacom HID 5214 Pen eraser" rotate ccw
# xsetwacom set "Wacom Intuos Pro M Pen stylus" rotate ccw
# # Set drawing area to left side on 3840x2160 monitor
# xsetwacom set "Wacom Intuos Pro M Pen stylus" MapToOutput 1080x1920+130+130
# xsetwacom set "Wacom Intuos Pro M Finger touch" MapToOutput 1080x1920+130+130
# xsetwacom set "Wacom HID 5214 Pen stylus" MapToOutput 1080x1920+130+130
# xsetwacom set "Wacom HID 5214 Finger touch" MapToOutput 1080x1920+130+130
# xsetwacom set "Wacom Intuos Pro M Pen eraser" MapToOutput 1080x1920+130+130
# xsetwacom set "Wacom Intuos Pro M Pen cursor" MapToOutput 1080x1920+130+130
# xsetwacom set "Wacom HID 5214 Pen eraser" MapToOutput 1080x1920+130+130
# xsetwacom set "Wacom Intuos Pro M Pen stylus" MapToOutput 1080x1920+130+130
#
# Laptop touch display
#
xsetwacom set "Wacom HID 5214 Pen stylus" rotate none
xsetwacom set "Wacom HID 5214 Finger touch" rotate none
xsetwacom set "Wacom HID 5214 Pen eraser" rotate none
xsetwacom set "Wacom HID 5214 Pen eraser" MapToOutput 1920x1080+0+0
xsetwacom set "Wacom HID 5214 Pen stylus" MapToOutput 1920x1080+0+0
xsetwacom set "Wacom HID 5214 Finger touch" MapToOutput 1920x1080+0+0

View File

@ -1,25 +0,0 @@
#!/usr/bin/env bash
# Note: this script gets called from $HOME/.config/autorandr/docked/postswitch,
# default drawing area on my 4K monitor
# Rotate drawing are for vertical drawing
# (physical controls above drawing area)
xsetwacom set "Wacom Intuos Pro M Pen stylus" rotate ccw
xsetwacom set "Wacom Intuos Pro M Finger touch" rotate ccw
xsetwacom set "Wacom HID 5214 Pen stylus" rotate ccw
xsetwacom set "Wacom HID 5214 Finger touch" rotate ccw
xsetwacom set "Wacom Intuos Pro M Pen eraser" rotate ccw
xsetwacom set "Wacom Intuos Pro M Pen cursor" rotate ccw
xsetwacom set "Wacom HID 5214 Pen eraser" rotate ccw
xsetwacom set "Wacom Intuos Pro M Pen stylus" rotate ccw
# Set drawing area to left side on 3840x2160 monitor
xsetwacom set "Wacom Intuos Pro M Pen stylus" MapToOutput 1080x1920+130+130
xsetwacom set "Wacom Intuos Pro M Finger touch" MapToOutput 1080x1920+130+130
xsetwacom set "Wacom HID 5214 Pen stylus" MapToOutput 1080x1920+130+130
xsetwacom set "Wacom HID 5214 Finger touch" MapToOutput 1080x1920+130+130
xsetwacom set "Wacom Intuos Pro M Pen eraser" MapToOutput 1080x1920+130+130
xsetwacom set "Wacom Intuos Pro M Pen cursor" MapToOutput 1080x1920+130+130
xsetwacom set "Wacom HID 5214 Pen eraser" MapToOutput 1080x1920+130+130
xsetwacom set "Wacom Intuos Pro M Pen stylus" MapToOutput 1080x1920+130+130

View File

@ -1 +1 @@
$HOME/.bin/wacom-vertical-draw-area $HOME/.bin/set-wacom-draw-area