From 5b7cb294df9aa1acb9fa2c825e493c63c443d114 Mon Sep 17 00:00:00 2001 From: Price Hiller Date: Thu, 31 Aug 2023 11:53:56 -0500 Subject: [PATCH] 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. --- dots/.config/hypr/scripts/disable-laptop-screen.bash | 11 +++++++++++ dots/.config/hypr/wm/monitors.conf | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) create mode 100755 dots/.config/hypr/scripts/disable-laptop-screen.bash diff --git a/dots/.config/hypr/scripts/disable-laptop-screen.bash b/dots/.config/hypr/scripts/disable-laptop-screen.bash new file mode 100755 index 00000000..57d50441 --- /dev/null +++ b/dots/.config/hypr/scripts/disable-laptop-screen.bash @@ -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 diff --git a/dots/.config/hypr/wm/monitors.conf b/dots/.config/hypr/wm/monitors.conf index d65fc01e..f7852a17 100644 --- a/dots/.config/hypr/wm/monitors.conf +++ b/dots/.config/hypr/wm/monitors.conf @@ -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