Files
dotfiles/bin/lid_close.sh
Thierry Schork 9438964c80 - added mpc config
- removed language from waybar
- corrected cycle_pactl.sh to ignoe headphone and hdmi outputs
- enabled icons in fuzzel
- enforcing suspend when closing the lid with no external monitor turned on
- corrected windowrules for jetbrain tools
2026-02-13 21:43:03 +01:00

31 lines
625 B
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
INTERNAL="eDP-1"
sleep 0.2
external_on_count=$(
hyprctl -j monitors | jq -r --arg internal "$INTERNAL" '
[ .[]
| select(.name != $internal)
| select(.disabled != true)
| select(.dpmsStatus == true)
] | length
'
)
if [ "$external_on_count" -eq 0 ]; then
# no external screen, we sleep
#systemctl hybrid-sleep
#systemctl suspend-then-hibernate
#debounce hyprlock
pgrep -x hyprlock >/dev/null || hyprlock
systemctl suspend-then-hibernatehyprctl
else
# docked, we turn off internal screen
hyprctl keyword monitor "$INTERNAL, disable"
fi