Files
illogical-impulse/sdata/subcmd-virtmon/hypr_mon_guard
T
2025-11-13 01:47:21 +08:00

14 lines
499 B
Bash
Executable File

#!/usr/bin/bash
# This script is to prevent hyprland from not responding to any input when no monitor is enabled.
# When this script is running in background,
# it will be safe to temporarily disable monitors using hyprctl.
# The shebang cannot be #!/usr/bin/env bash , idk why
while true; do
readarray -t enabled_mons < <(hyprctl -j monitors all | jq -r '.[] | select(.disabled == false) | .name')
#if -z "$enabled_mons"; then
if [ ${#enabled_mons[@]} -eq 0 ]; then
hyprctl reload
fi
sleep 30
done