rotation script

main
The_miro 2025-12-09 18:36:13 +01:00
parent 006b8b1aea
commit af4465a89c
1 changed files with 8 additions and 3 deletions

View File

@ -4,14 +4,15 @@
# Usage: rotate.sh [cw|ccw] # Usage: rotate.sh [cw|ccw]
direction="$1" direction="$1"
if [[ "$direction" != "cw" && "$direction" != "ccw" ]]; then if [[ "$direction" != "cw" && "$direction" != "ccw" && "$direction" != "0" && "$direction" != "1" && "$direction" != "2" && "$direction" != "3" ]]; then
echo "Usage: $0 [cw|ccw]" echo "Usage: $0 [cw|ccw] OR $0 [0|1|2|3]"
exit 1 exit 1
fi fi
# Get current monitor name # Get current monitor name
# curmon=$(hyprctl monitors | awk '/focused: yes/{getline; print $2}')
curmon=$(hyprctl monitors | grep -B12 "focused: yes" | head -n1 | awk '{print $2}') curmon=$(hyprctl monitors | grep -B12 "focused: yes" | head -n1 | awk '{print $2}')
# curmon=$(hyprctl monitors | awk '/focused: yes/{getline; print $2}')
# Get current transform value # Get current transform value
# currot=$(hyprctl monitors | awk '/focused: yes/{for(i=0;i<15;i++){getline;if($1=="transform:"){print $2;break}}}') # currot=$(hyprctl monitors | awk '/focused: yes/{for(i=0;i<15;i++){getline;if($1=="transform:"){print $2;break}}}')
@ -32,6 +33,10 @@ else # ccw
fi fi
fi fi
if [[ "$direction" == "0" || "$direction" == "1" || "$direction" == "2" || "$direction" == "3" ]]; then
newrot="$direction"
fi
echo "Rotating monitor '$curmon' from $currot to $newrot ($direction)" echo "Rotating monitor '$curmon' from $currot to $newrot ($direction)"
# Apply new rotation to monitor # Apply new rotation to monitor