From ab3bb9bcdda285c2a1b1109e85e44f858818f60c Mon Sep 17 00:00:00 2001 From: Anjandev Momi Date: Sun, 8 Nov 2020 15:41:41 -0500 Subject: [PATCH] kill the keyboard on rotation --- scripts/core/sxmo_rotate.sh | 6 +++++- scripts/core/sxmo_rotateautotoggle.sh | 6 +++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/scripts/core/sxmo_rotate.sh b/scripts/core/sxmo_rotate.sh index 02f99bc..b1d01e7 100755 --- a/scripts/core/sxmo_rotate.sh +++ b/scripts/core/sxmo_rotate.sh @@ -1,7 +1,7 @@ #!/usr/bin/env sh applyptrmatrix() { - PTRID="$( + PTRID="$( xinput | grep -iE 'touchscreen.+pointer' | grep -oE 'id=[0-9]+' | cut -d= -f2 )" xinput set-prop "$PTRID" --type=float --type=float "Coordinate Transformation Matrix" "$@" @@ -9,10 +9,12 @@ applyptrmatrix() { isrotated() { xrandr | grep primary | cut -d' ' -f 5 | grep right && return 0 + xrandr | grep primary | cut -d' ' -f 5 | grep left && return 0 return 1 } rotnormal() { + pkill "$KEYBOARD" xrandr -o normal applyptrmatrix 0 0 0 0 0 0 0 0 0 pkill lisgd @@ -21,6 +23,7 @@ rotnormal() { } rotright() { + pkill "$KEYBOARD" xrandr -o right applyptrmatrix 0 1 0 -1 0 1 0 0 1 pkill lisgd @@ -29,6 +32,7 @@ rotright() { } rotleft() { + pkill "$KEYBOARD" xrandr -o left applyptrmatrix 0 -1 1 1 0 0 0 0 1 pkill lisgd diff --git a/scripts/core/sxmo_rotateautotoggle.sh b/scripts/core/sxmo_rotateautotoggle.sh index 5aae5a0..e3f450c 100755 --- a/scripts/core/sxmo_rotateautotoggle.sh +++ b/scripts/core/sxmo_rotateautotoggle.sh @@ -18,11 +18,11 @@ autorotateenable() { while true; do y_raw="$(cat "$FILE_Y")" x_raw="$(cat "$FILE_X")" - if [ "$x_raw" -ge "$RIGHT_SIDE_UP" ]; then + if [ "$x_raw" -ge "$RIGHT_SIDE_UP" ] && sxmo_rotate.sh isrotated ; then sxmo_rotate.sh rotnormal - elif [ "$y_raw" -le "$UPSIDE_DOWN" ]; then + elif [ "$y_raw" -le "$UPSIDE_DOWN" ] && [ "$(sxmo_rotate.sh isrotated)" != "right" ]; then sxmo_rotate.sh rotright - elif [ "$y_raw" -ge "$RIGHT_SIDE_UP" ]; then + elif [ "$y_raw" -ge "$RIGHT_SIDE_UP" ] && [ "$(sxmo_rotate.sh isrotated)" != "left" ]; then sxmo_rotate.sh rotleft fi sleep "$POLL_TIME"