fix(hypr): properly disable laptop monitor on close

This only shuts off the laptop monitor if there's more than 1 monitor
detected. If there's only 1 detected then that's the laptop screen and
that will get shut off on lid close by systemd for suspend.
This commit is contained in:
Price Hiller 2023-08-31 11:53:56 -05:00
parent 89a67931d3
commit 5b7cb294df
Signed by: Price
SSH Key Fingerprint: SHA256:Y4S9ZzYphRn1W1kbJerJFO6GGsfu9O70VaBSxJO7dF8
2 changed files with 12 additions and 1 deletions

View File

@ -0,0 +1,11 @@
#!/usr/bin/env bash
main() {
local mon_count
mon_count="$(hyprctl monitors -j | jq length)"
if (( mon_count > 1 )); then
hyprctl keyword monitor "eDP-1, disable"
fi
}
main

View File

@ -1,4 +1,4 @@
monitor = , preferred, auto, 1
monitor=eDP-1,preferred,auto,1.4
bindl=,switch:off:Lid Switch,exec,hyprctl keyword monitor "eDP-1, preferred, auto, 1"
bindl=,switch:on:Lid Switch,exec,hyprctl keyword monitor "eDP-1, disable"
bindl=,switch:on:Lid Switch,exec,~/.config/hypr/scripts/disable-laptop-screen.bash