From 7f591afc56a7b644a517ab6359fecb8c457b6e8b Mon Sep 17 00:00:00 2001 From: The_miro Date: Fri, 28 Nov 2025 10:30:10 +0100 Subject: [PATCH] Add desktopenvs/hyprland/scripts/screenrotationacw.sh --- .../hyprland/scripts/screenrotationacw.sh | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 desktopenvs/hyprland/scripts/screenrotationacw.sh diff --git a/desktopenvs/hyprland/scripts/screenrotationacw.sh b/desktopenvs/hyprland/scripts/screenrotationacw.sh new file mode 100644 index 0000000..cbcd466 --- /dev/null +++ b/desktopenvs/hyprland/scripts/screenrotationacw.sh @@ -0,0 +1,33 @@ + +#!/bin/bash + +# Get current monitor name +curmon=$(hyprctl monitors | awk '/focused: yes/{getline; print $2}') + +# Get current transform value +currot=$(hyprctl monitors | awk '/focused: yes/{for(i=0;i<15;i++){getline;if($1=="transform:"){print $2;break}}}') + +# Calculate new rotation (cycle through 0-3) +if [[ "$currot" == "3" ]]; then + newrot="0" +else + newrot=$((currot + 1)) +fi + +echo "Rotating monitor '$curmon' from $currot to $newrot" + +# Apply new rotation to monitor +hyprctl keyword monitor "$curmon,preferred,auto,0x0,$newrot" + +# Detect touchscreen device name +touchdev=$(hyprctl devices | awk '/Touchscreen/{getline; print $2}') + +if [[ -n "$touchdev" ]]; then + echo "Applying same rotation to touchscreen: $touchdev" + hyprctl keyword "device:$touchdev" transform "$newrot" +else + echo "No touchscreen device detected." +fi + +# Reload Eww to adjust bar size +eww reload