From 45193f0f85be0b471a9ac3a20104d43502516bea Mon Sep 17 00:00:00 2001 From: Hektor Misplon Date: Sun, 28 Nov 2021 17:42:21 +0100 Subject: [PATCH] Update wacom draw area script --- .bin/set-wacom-draw-area | 84 +++++++++++++++++++++++++++++ .bin/wacom-vertical-draw-area | 25 --------- .config/autorandr/docked/postswitch | 2 +- 3 files changed, 85 insertions(+), 26 deletions(-) create mode 100755 .bin/set-wacom-draw-area delete mode 100755 .bin/wacom-vertical-draw-area diff --git a/.bin/set-wacom-draw-area b/.bin/set-wacom-draw-area new file mode 100755 index 0000000..6733193 --- /dev/null +++ b/.bin/set-wacom-draw-area @@ -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 diff --git a/.bin/wacom-vertical-draw-area b/.bin/wacom-vertical-draw-area deleted file mode 100755 index 889449f..0000000 --- a/.bin/wacom-vertical-draw-area +++ /dev/null @@ -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 diff --git a/.config/autorandr/docked/postswitch b/.config/autorandr/docked/postswitch index 880ff2b..6ff49f7 100644 --- a/.config/autorandr/docked/postswitch +++ b/.config/autorandr/docked/postswitch @@ -1 +1 @@ -$HOME/.bin/wacom-vertical-draw-area +$HOME/.bin/set-wacom-draw-area