Compare commits

..

No commits in common. "ef4a0a483d075ad9502b52f9b8bd0598b587225b" and "7b9379b1c18c504062bc3f233e80be1595654f36" have entirely different histories.

3 changed files with 19 additions and 13 deletions

View File

@ -10,7 +10,7 @@ if [ "$statecon" != "" ]; then
else
notify-send -t 1000 "caffeine mode off"
hypridle &
hyprctl dispatch exec hypridle
fi

View File

@ -5,13 +5,13 @@ export STATUS_FILE="$XDG_RUNTIME_DIR/keyboard.status"
enable_keyboard() {
printf "true" >"$STATUS_FILE"
notify-send -u normal "Enabling Touchpad"
hyprctl keyword 'device[synaptics-tm3053-009]:enabled' "true"
hyprctl keyword '$LAPTOP_KB_ENABLED' "true" -r
}
disable_keyboard() {
printf "false" >"$STATUS_FILE"
notify-send -u normal "Disabling Touchpad"
hyprctl keyword 'device[synaptics-tm3053-009]:enabled' "false"
hyprctl keyword '$LAPTOP_KB_ENABLED' "false" -r
}
if ! [ -f "$STATUS_FILE" ]; then

View File

@ -6,13 +6,17 @@ direction="$1"
if [[ "$direction" != "cw" && "$direction" != "ccw" && "$direction" != "0" && "$direction" != "1" && "$direction" != "2" && "$direction" != "3" ]]; then
echo "Usage: $0 [cw|ccw] OR $0 [0|1|2|3]"
exit 1
fi
monitors_json=$(hyprctl monitors -j)
# Get current monitor name
curmon=$(hyprctl monitors | grep -B12 "focused: yes" | head -n1 | awk '{print $2}')
# curmon=$(hyprctl monitors | awk '/focused: yes/{getline; print $2}')
curmon=$(echo "$monitors_json" | jq -r '.[] | select(.focused) | .name')
currot=$(echo "$monitors_json" | jq -r '.[] | select(.focused) | .transform')
# 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 | grep -B1 "focused: yes" | head -n1 | awk '{print $2}')
# Calculate new rotation
if [[ "$direction" == "cw" ]]; then
@ -21,27 +25,29 @@ if [[ "$direction" == "cw" ]]; then
else
newrot=$((currot + 1))
fi
elif [[ "$direction" == "ccw" ]]; then
else # ccw
if [[ "$currot" == "0" ]]; then
newrot="3"
else
newrot=$((currot - 1))
fi
else
newrot="$direction"
fi
if [[ "$direction" == "0" || "$direction" == "1" || "$direction" == "2" || "$direction" == "3" ]]; then
newrot="$direction"
fi
echo "Rotating monitor '$curmon' from $currot to $newrot ($direction)"
# Apply new rotation to monitor (hyprctl keyword doesn't work with Lua config)
hyprctl eval "hl.monitor({output='$curmon', transform=$newrot})"
# Apply new rotation to monitor
hyprctl keyword monitor "$curmon,preferred,auto,1,transform,$newrot"
# Detect touchscreen device name
touchdev=$(hyprctl devices -j | jq -r '.touch[0].name // empty')
touchdev=$(hyprctl devices | awk '/Touch Device/{getline; print $1}')
if [[ -n "$touchdev" ]]; then
echo "Applying same rotation to touchscreen: $touchdev"
hyprctl eval "hl.device({name='$touchdev', transform=$newrot})"
hyprctl keyword "device[$touchdev]:transform" "$newrot"
else
echo "No touchscreen device detected."
fi