summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--.config/sway/binds.conf4
-rwxr-xr-xbin/r2mem10
2 files changed, 13 insertions, 1 deletions
diff --git a/.config/sway/binds.conf b/.config/sway/binds.conf
index fd15686..619b47b 100644
--- a/.config/sway/binds.conf
+++ b/.config/sway/binds.conf
@@ -246,7 +246,6 @@ mode "menu" {
   bindsym p exec passmenu; mode "default"
   bindsym r exec rcmenu; mode "default"
   # bindsym x exec menu -drun; mode "default"
-  bindsym 6 exec s6menu; mode "default"
   bindsym d exec swdo; mode "default"
 
   bindsym Return mode "default"
@@ -287,3 +286,6 @@ bindsym $mod+F1 exec notify-send "hello from F1"
 bindsym $mod+F2 exec notify-send "hello from F2"
 bindsym $mod+F3 exec notify-send "hello from F3"
 # }}}
+
+# go to sleep when lid is closed
+bindswitch --reload lid:on exec r2mem
diff --git a/bin/r2mem b/bin/r2mem
new file mode 100755
index 0000000..0120dbb
--- /dev/null
+++ b/bin/r2mem
@@ -0,0 +1,10 @@
+#!/bin/sh
+# setup trap to reset backlight
+# shellcheck disable=SC2064
+trap "light -S $(light -G)" EXIT
+# dim backlight before locking to avoid lockscreen flash
+light -S "$(light -P)"
+# setup lockscreen
+lock >/dev/null 2>&1
+# go to sleep
+echo mem | doas tee /sys/power/state >/dev/null