This repository has been archived on 2025-04-18. You can view files and clone it, but you cannot make any changes to its state, such as pushing and creating new issues, pull requests or comments.
dotfiles/misc/scripts/lidclose.sh
2024-03-10 22:20:12 +00:00

15 lines
449 B
Bash
Executable file

#!/usr/bin/env bash
# Count the number of connected monitors
connected_monitors=$(xrandr | grep " connected " | wc -l)
# Check if more than one monitor is connected
if [ $connected_monitors -gt 1 ]; then
# Disable LVDS-1
hyprctl keyword monitor LVDS-1, disable
else
# Send computer to sleep
swayidle -w \
timeout 1800 'hyprctl dispatch dpms off' \
resume 'hyprctl dispatch dpms on' \
timeout 3600 'systemctl suspend'
fi