Files
dotfiles-xps/hypr/scripts/lid_handler.sh
2026-01-14 11:28:55 +01:00

18 lines
699 B
Bash
Executable File

#!/bin/bash
# ~/.config/hypr/scripts/lid_handler.sh
if [[ "$1" == "close" ]]; then
# Lid closed: disable laptop screen if any DP-* monitor is present
# Using 'all' to detect monitors even if they are currently disabled
if hyprctl monitors all | grep -q "Monitor DP-"; then
hyprctl keyword monitor "eDP-1, disable" # Disable laptop display
# Enable all detected DP-* monitors
for monitor in $(hyprctl monitors all | grep "Monitor DP-" | awk '{print $2}'); do
hyprctl keyword monitor "$monitor, enable"
done
fi
elif [[ "$1" == "open" ]]; then
# Lid opened: re-enable laptop screen
hyprctl keyword monitor "eDP-1, enable"
fi