mirror of
https://codeberg.org/privacy1st/arch
synced 2024-12-26 01:36:05 +01:00
30 lines
713 B
Plaintext
30 lines
713 B
Plaintext
|
#!/bin/bash
|
||
|
|
||
|
# Output of "monitor-sensor --accel | grep 'orientation'":
|
||
|
# === Has accelerometer (orientation: normal)
|
||
|
# Accelerometer orientation changed: right-up
|
||
|
|
||
|
# Feed output of 'monitor-sensor' and stop after first match of 'orientation'
|
||
|
ORIENTATION_STR="$(grep -m 1 'orientation' <( monitor-sensor ))" || exit $?
|
||
|
|
||
|
case "${ORIENTATION_STR}" in
|
||
|
*": normal"*)
|
||
|
ORIENTATION="normal";
|
||
|
;;
|
||
|
*": bottom-up"*)
|
||
|
ORIENTATION="inverted";
|
||
|
;;
|
||
|
*": right-up"*)
|
||
|
ORIENTATION="left";
|
||
|
;;
|
||
|
*": left-up"*)
|
||
|
ORIENTATION="right";
|
||
|
;;
|
||
|
*)
|
||
|
echo "Could not parse ORIENTATION_STR!";
|
||
|
exit 1;
|
||
|
esac
|
||
|
|
||
|
# echo "Detected device orientation ${ORIENTATION}"
|
||
|
de-p1st-rotate-screen "${ORIENTATION}"
|