Auto rotate screen on physical keyboard opened/closed
Signed-off-by: Willow Barraco <contact@willowbarraco.fr>
This commit is contained in:
@@ -93,6 +93,10 @@ case "$WMCLASS" in
|
||||
sxmo_daemons.sh running autorotate -q &&
|
||||
printf "%s" "$icon_ton" || printf "%s" "$icon_tof"
|
||||
) ^ 1 ^ toggle_daemon 'Autorotate' autorotate sxmo_autorotate.sh
|
||||
$([ -n "$SXMO_KEYBOARD_SLIDER_EVENT_DEVICE" ] && echo "$icon_ror Autorotate on Keyboard Open/Close $(
|
||||
sxmo_daemons.sh running kb_autorotate -q &&
|
||||
printf "%s" "$icon_ton" || printf "%s" "$icon_tof"
|
||||
) ^ 1 ^ toggle_daemon 'Keyboard Autorotate' kb_autorotate sxmo_keyboard_autorotate.sh")
|
||||
$icon_ror Rotate ^ 1 ^ sxmo_rotate.sh rotate
|
||||
$icon_trm Hooks ^ 0 ^ sxmo_hookmenu.sh
|
||||
$icon_upc Upgrade Pkgs ^ 0 ^ sxmo_terminal.sh sxmo_upgrade.sh
|
||||
|
26
scripts/core/sxmo_keyboard_autorotate.sh
Executable file
26
scripts/core/sxmo_keyboard_autorotate.sh
Executable file
@@ -0,0 +1,26 @@
|
||||
#!/bin/sh
|
||||
# SPDX-License-Identifier: AGPL-3.0-only
|
||||
# Copyright 2022 Sxmo Contributors
|
||||
|
||||
# shellcheck source=scripts/core/sxmo_common.sh
|
||||
. sxmo_common.sh
|
||||
|
||||
keyboard_opened() {
|
||||
if sxmo_rotate.sh isrotated ; then
|
||||
sxmo_rotate.sh rotnormal
|
||||
fi
|
||||
}
|
||||
|
||||
keyboard_closed() {
|
||||
if [ "$(sxmo_rotate.sh isrotated)" != "left" ]; then
|
||||
sxmo_rotate.sh rotleft
|
||||
fi
|
||||
}
|
||||
|
||||
evtest "$SXMO_KEYBOARD_SLIDER_EVENT_DEVICE" | while read -r line; do
|
||||
# shellcheck disable=SC2254
|
||||
case $line in
|
||||
($SXMO_KEYBOARD_SLIDER_CLOSE_EVENT) keyboard_closed ;;
|
||||
($SXMO_KEYBOARD_SLIDER_OPEN_EVENT) keyboard_opened ;;
|
||||
esac
|
||||
done
|
Reference in New Issue
Block a user