[rc/sway] bind XF86PowerOff to prompt for system exit action
[~bandali/configs] / rc.org
diff --git a/rc.org b/rc.org
index dcce8ab..654bd8e 100644 (file)
--- a/rc.org
+++ b/rc.org
@@ -3771,6 +3771,10 @@ insert_pass="Alt+n"
 #+begin_src conf
 exec xrdb .Xresources
 exec dunst
+exec pgrep -x "systemd-inhibit" || \
+     systemd-inhibit --what=handle-power-key --who=aminb \
+     --why="Handle power button in sway" sleep infinity
+
 ### Variables
 # super
 set $mod Mod4
@@ -3797,8 +3801,8 @@ output * bg /usr/share/backgrounds/sway/Sway_Wallpaper_Blue_1920x1080.png fill
 ### Idle configuration
 
 exec swayidle \
-   timeout 60 swaylock \
-   timeout 120 'swaymsg "output * dpms off"' \
+   timeout 120 swaylock \
+   timeout 180 'swaymsg "output * dpms off"' \
       resume   'swaymsg "output * dpms on"'  \
    before-sleep swaylock
 
@@ -3812,6 +3816,14 @@ input "1739:31251:DLL07BE:01_06CB:7A13_Touchpad" {
     click_method clickfinger
 }
 
+input "2:7:SynPS/2_Synaptics_TouchPad" {
+    events disabled
+    dwt enabled
+    tap enabled
+    natural_scroll enabled
+    click_method clickfinger
+}
+
 input "1:1:AT_Translated_Set_2_keyboard" {
     repeat_delay 200
     repeat_rate 45
@@ -3982,6 +3994,27 @@ mode "resize" {
 }
 bindsym $mod+Shift+r mode "resize"
 
+#
+# Power button
+#
+set $locker swaylock && sleep 1
+
+set $mode_system System (l)ock, (e)xit sway, (s)uspend, (h)ibernate, (r)eboot, (S)hutdown
+mode "$mode_system" {
+    bindsym l       exec $locker,                          mode "default"
+    bindsym e       exec swaymsg exit,                     mode "default"
+    bindsym s       exec $locker && systemctl suspend,     mode "default"
+    bindsym h       exec $locker && systemctl hibernate,   mode "default"
+    bindsym r       exec            systemctl reboot,      mode "default"
+    bindsym Shift+s exec            systemctl poweroff -i, mode "default"
+
+    # back to normal: Enter, Escape, or q
+    bindsym Return mode "default"
+    bindsym Escape mode "default"
+    bindsym q      mode "default"
+}
+bindsym XF86PowerOff mode "$mode_system"
+
 #
 # Status Bar:
 #
@@ -3996,6 +4029,9 @@ bar {
     status_command i3status
 }
 
+# font pango: benis uushi 9
+font pango: Ubuntu Mono 11
+
 include /etc/sway/config.d/*
 #+end_src