Add rotation script sxmo_rotate.sh which fixes touchscreen input

master
Miles Alan 5 years ago
parent 46f26e609e
commit 23d6a29926
  1. 6
      scripts/core/sxmo_appmenu.sh
  2. 31
      scripts/core/sxmo_rotate.sh

@ -50,7 +50,7 @@ programchoicesinit() {
Modem Log ^ 0 ^ sxmo_modemlog.sh Modem Log ^ 0 ^ sxmo_modemlog.sh
Flash $(cat /sys/class/leds/white:flash/brightness | grep -E '^0$' > /dev/null && echo -n "Off → On" || echo -n "On → Off") ^ 1 ^ sxmo_flashtoggle.sh Flash $(cat /sys/class/leds/white:flash/brightness | grep -E '^0$' > /dev/null && echo -n "Off → On" || echo -n "On → Off") ^ 1 ^ sxmo_flashtoggle.sh
Bar Toggle ^ 1 ^ key Alt+b Bar Toggle ^ 1 ^ key Alt+b
Rotate ^ 1 ^ rotate Rotate ^ 1 ^ sxmo_rotate.sh
Wifi ^ 0 ^ st -e "nmtui" Wifi ^ 0 ^ st -e "nmtui"
Audio Out ^ 0 ^ sxmo_audiooutmenu.sh Audio Out ^ 0 ^ sxmo_audiooutmenu.sh
Upgrade Pkgs ^ 0 ^ st -e sxmo_upgrade.sh Upgrade Pkgs ^ 0 ^ st -e sxmo_upgrade.sh
@ -161,10 +161,6 @@ getprogchoices() {
PROGCHOICES="$(echo "$CHOICES" | xargs -0 echo | sed '/^[[:space:]]*$/d' | awk '{$1=$1};1')" PROGCHOICES="$(echo "$CHOICES" | xargs -0 echo | sed '/^[[:space:]]*$/d' | awk '{$1=$1};1')"
} }
rotate() {
xrandr | grep primary | cut -d' ' -f 5 | grep right && xrandr -o normal || xrandr -o right
}
key() { key() {
xdotool windowactivate "$WIN" xdotool windowactivate "$WIN"
xdotool key --clearmodifiers "$1" xdotool key --clearmodifiers "$1"

@ -0,0 +1,31 @@
#!/usr/bin/env sh
applyptrmatrix() {
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" "$@"
}
isrotated() {
xrandr | grep primary | cut -d' ' -f 5 | grep right && return 0
return 1
}
rotnormal() {
xrandr -o normal
applyptrmatrix 0 0 0 0 0 0 0 0 0
exit 0
}
rotright() {
xrandr -o right
applyptrmatrix 0 1 0 -1 0 1 0 0 1
exit 0
}
rotate() {
isrotated && rotnormal || rotright
}
rotate
Loading…
Cancel
Save