From b7b431038f0a144ea77c21ecebeb0d6a21a88452 Mon Sep 17 00:00:00 2001 From: Valentin Gehrke Date: Sat, 24 Oct 2015 02:10:31 +0200 Subject: [PATCH] Cleanup tabletmode --- tablet/.config/scripts/tabletmode.sh | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/tablet/.config/scripts/tabletmode.sh b/tablet/.config/scripts/tabletmode.sh index b6224ab..2e08e91 100755 --- a/tablet/.config/scripts/tabletmode.sh +++ b/tablet/.config/scripts/tabletmode.sh @@ -5,14 +5,26 @@ cd $(dirname $0) INTERN="LVDS1" IDS=$(./wacomdevices.sh) +set_monitor_rotation() { + rotation=${1:-normal} + xrandr --output $INTERN --rotate $rotation +} + +set_tablet_rotation() { + rotation=${1:-none} + for i in $IDS; do xsetwacom set $i Rotate $rotation; done +} + +set_tablet_output() { + output=${1:-LVDS1} + for i in $IDS; do xsetwacom set $i MapToOutput $output; done +} + if [ "$1" == "on" ]; then - #xrandr --output $INTERN --rotate left - xrandr --output $INTERN --rotate inverted - - for i in $IDS; do xsetwacom set $i Rotate half; done + set_monitor_rotation inverted + set_tablet_rotation half + set_tablet_output $INTERN else - #xrandr --output $INTERN --rotate left - xrandr --output $INTERN --rotate normal - - for i in $IDS; do xsetwacom set $i Rotate none; done + set_monitor_rotation normal + set_tablet_rotation none fi