You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
- #!/bin/bash
-
- function rotate
- {
- kill -10 `pidof waybar`
- }
-
- ROTFILE=/tmp/sway_rotation
- PREV=-1
- if [[ -f $ROTFILE ]]
- then
- PREV=$(<$ROTFILE)
- fi
- TRANSFORM=`swaymsg -p -t get_outputs | grep -A 15 "Output DSI-1" | grep "Transform:"`
- NOW=-1
-
- if [[ $TRANSFORM == *"normal"* ]]; then
- NOW=0
- elif [[ $TRANSFORM == *"90"* ]]; then
- NOW=1
- elif [[ $TRANSFORM == *"180"* ]]; then
- NOW=2
- elif [[ $TRANSFORM == *"270"* ]]; then
- NOW=3
- fi
-
- echo $NOW > $ROTFILE
-
- if [[ $(($PREV % 2)) -eq $(($NOW % 2)) ]]; then
- echo "No change."
- else
- echo Rotated from $PREV to $NOW.
- rotate
- fi
|