aboutsummaryrefslogtreecommitdiff
path: root/misc/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'misc/scripts')
-rwxr-xr-xmisc/scripts/lidclose.sh15
-rwxr-xr-xmisc/scripts/lidopen.sh3
2 files changed, 18 insertions, 0 deletions
diff --git a/misc/scripts/lidclose.sh b/misc/scripts/lidclose.sh
new file mode 100755
index 0000000..c3c2673
--- /dev/null
+++ b/misc/scripts/lidclose.sh
@@ -0,0 +1,15 @@
+#!/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
diff --git a/misc/scripts/lidopen.sh b/misc/scripts/lidopen.sh
new file mode 100755
index 0000000..0269352
--- /dev/null
+++ b/misc/scripts/lidopen.sh
@@ -0,0 +1,3 @@
+#!/usr/bin/env bash
+
+hyprctl keyword monitor LVDS-1, preferred, auto, 1