finally fixed the unified-rotate script

main
The_miro 2025-12-09 14:19:21 +01:00
parent bd6fba866f
commit 006b8b1aea
1 changed files with 5 additions and 3 deletions

View File

@ -10,10 +10,12 @@ if [[ "$direction" != "cw" && "$direction" != "ccw" ]]; then
fi fi
# Get current monitor name # Get current monitor name
curmon=$(hyprctl monitors | awk '/focused: yes/{getline; print $2}') # curmon=$(hyprctl monitors | awk '/focused: yes/{getline; print $2}')
curmon=$(hyprctl monitors | grep -B12 "focused: yes" | head -n1 | awk '{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}}}')
currot=$(hyprctl monitors | grep -B1 "focused: yes" | head -n1 | awk '{print $2}')
# Calculate new rotation # Calculate new rotation
if [[ "$direction" == "cw" ]]; then if [[ "$direction" == "cw" ]]; then
@ -33,7 +35,7 @@ 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
hyprctl keyword monitor "$curmon,preferred,auto,0x0,$newrot" hyprctl keyword monitor "$curmon,preferred,auto,1,transform,$newrot"
# Detect touchscreen device name # Detect touchscreen device name
touchdev=$(hyprctl devices | awk '/Touchscreen/{getline; print $2}') touchdev=$(hyprctl devices | awk '/Touchscreen/{getline; print $2}')