2019-11-20 22:26:52 +02:00
|
|
|
#!/bin/bash
|
|
|
|
function rotate_ms {
|
2022-09-16 20:08:03 +03:00
|
|
|
case $1 in
|
|
|
|
"normal")
|
|
|
|
swaymsg output eDP-1 transform 0
|
|
|
|
;;
|
|
|
|
"right-up")
|
|
|
|
swaymsg output eDP-1 transform 90
|
|
|
|
;;
|
|
|
|
"bottom-up")
|
|
|
|
swaymsg output eDP-1 transform 180
|
|
|
|
;;
|
|
|
|
"left-up")
|
|
|
|
swaymsg output eDP-1 transform 270
|
|
|
|
;;
|
|
|
|
esac
|
2019-11-20 22:26:52 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
while IFS='$\n' read -r line; do
|
2022-09-16 20:08:03 +03:00
|
|
|
rotation="$(echo $line | sed -En "s/^.*orientation changed: (.*)/\1/p")"
|
|
|
|
[[ ! -z $rotation ]] && rotate_ms $rotation
|
2019-11-20 22:26:52 +02:00
|
|
|
done < <(stdbuf -oL monitor-sensor)
|