diff options
author | lonkaars <loek@pipeframe.xyz> | 2024-02-24 17:28:34 +0100 |
---|---|---|
committer | lonkaars <loek@pipeframe.xyz> | 2024-02-24 17:28:34 +0100 |
commit | 3844f262627f079eac449085b69d0c754434d7fd (patch) | |
tree | afa28e1428431dd849d3974ff46ba9d0972477fb | |
parent | 0dcad8fb751f1758b5ae5288d299afc3b0323546 (diff) |
grab wacom screen resolution from xrandr
-rwxr-xr-x | .local/share/bin/wacommode | 12 |
1 files changed, 8 insertions, 4 deletions
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 '\<current\>[^,]\+' | 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 |