From 3844f262627f079eac449085b69d0c754434d7fd Mon Sep 17 00:00:00 2001 From: lonkaars Date: Sat, 24 Feb 2024 17:28:34 +0100 Subject: grab wacom screen resolution from xrandr --- .local/share/bin/wacommode | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to '.local/share') diff --git a/.local/share/bin/wacommode b/.local/share/bin/wacommode index c213118..3e8ff8a 100755 --- a/.local/share/bin/wacommode +++ b/.local/share/bin/wacommode @@ -11,17 +11,21 @@ defaults () { setwacom Rotate none } +SCREEN_1_GEOMETRY="$(xrandr -q | awk '$2 == "connected" && $3 == "primary" { print $4 }')" +SCREEN_2_GEOMETRY="$(xrandr -q | awk '$2 == "connected" && $3 != "primary" { print $3 }')" +ALL_GEOMETRY="$(xrandr -q | awk '$1 == "Screen" { print ; exit }' | grep -o '\[^,]\+' | sed -e 's/^current//' -e 's/ //g' -e 's/$/+0+0/')" + topleft() { notify-send "screen 1 only (landscape)" - setwacom MapToOutput 1920x1080+0+410 + setwacom MapToOutput "$SCREEN_1_GEOMETRY" } bottomleft() { notify-send "screen 2 only (portrait)" setwacom Rotate ccw - setwacom MapToOutput 1080x1920+1920+0 + setwacom MapToOutput "$SCREEN_2_GEOMETRY" } topright() { @@ -31,14 +35,14 @@ topright() { setwacom RawSample 1 setwacom Area 0 1623 7600 5898 - setwacom MapToOutput 1920x1080+0+410 + setwacom MapToOutput "$SCREEN_1_GEOMETRY" } bottomright() { notify-send "both screens (landscape)" setwacom Area 0 0 11875 7600 - setwacom MapToOutput 3000x1920+0+0 + setwacom MapToOutput "$ALL_GEOMETRY" } defaults -- cgit v1.2.3