From 33ef5a333ff6c002e059c01340503b1f87561abc Mon Sep 17 00:00:00 2001 From: Sebastian Bugge Date: Sun, 24 Nov 2024 19:13:49 +0100 Subject: [PATCH] Add system exit dialog. --- .config/i3/config | 15 +++++++++++++++ .config/i3/i3exit | 28 ++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+) create mode 100755 .config/i3/i3exit diff --git a/.config/i3/config b/.config/i3/config index afab7c9..3d0ddbf 100644 --- a/.config/i3/config +++ b/.config/i3/config @@ -179,6 +179,21 @@ mode "resize" { bindsym $mod+r mode "resize" +set $mode_system System (l) lock, (e) logout, (s) suspend, (h) hibernate, (r) reboot, (Shift+s) shutdown +mode "$mode_system" { + bindsym l exec --no-startup-id ~/.config/i3/i3exit lock, mode "default" + bindsym e exec --no-startup-id ~/.config/i3/i3exit logout, mode "default" + bindsym s exec --no-startup-id ~/.config/i3/i3exit suspend, mode "default" + bindsym h exec --no-startup-id ~/.config/i3/i3exit hibernate, mode "default" + bindsym r exec --no-startup-id ~/.config/i3/i3exit reboot, mode "default" + bindsym Shift+s exec --no-startup-id ~/.config/i3/i3exit shutdown, mode "default" + + # back to normal: Enter or Escape + bindsym Return mode "default" + bindsym Escape mode "default" +} +bindsym $mod+Escape mode "$mode_system" + exec xinput set-prop "DELL07E6:00 06CB:76AF Touchpad" "libinput Tapping Enabled" 1 exec xmodmap ~/.Xmodmap diff --git a/.config/i3/i3exit b/.config/i3/i3exit new file mode 100755 index 0000000..837b8ee --- /dev/null +++ b/.config/i3/i3exit @@ -0,0 +1,28 @@ +#!/usr/bin/env bash + +case "$1" in +lock) + i3lock + ;; +logout) + i3-msg exit + ;; +suspend) + i3lock && systemctl suspend + ;; +hibernate) + i3lock && systemctl hibernate + ;; +reboot) + systemctl reboot + ;; +shutdown) + systemctl poweroff + ;; +*) + echo "Usage: $0 [lock|logout|suspend|hibernate|reboot|shutdown]" + exit 2 + ;; +esac + +exit 0