From c0465ec22d01e615fa68dadacc7f65607fb0880f Mon Sep 17 00:00:00 2001 From: Ohad Livne Date: Wed, 4 Jun 2025 22:45:43 +0300 Subject: [PATCH] Write a script for shutdown options --- .config/sway/config | 4 ++-- .local/bin/leave | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+), 2 deletions(-) create mode 100755 .local/bin/leave diff --git a/.config/sway/config b/.config/sway/config index 2cb286b..554d635 100644 --- a/.config/sway/config +++ b/.config/sway/config @@ -102,8 +102,8 @@ input type:touchpad { bindsym $wm_mod+semicolon exec swaylock -f -c $(dd if=/dev/urandom bs=1 count=3 2>/dev/null | hexdump -e '"%02x"') # Exit sway (logs you out of your Wayland session) - bindsym $wm_mod+Delete exec swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway? This will end your Wayland session.' -B 'Yes, exit sway' 'swaymsg exit' - bindsym Alt+Ctrl+Delete exec swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway? This will end your Wayland session.' -B 'Yes, exit sway' 'swaymsg exit' + bindsym $wm_mod+Delete exec leave + bindsym Alt+Ctrl+Delete exec leave bindsym Alt+Ctrl+Shift+Delete exec systemctl poweroff bindsym Alt+Ctrl+Backspace exec swaymsg exit # diff --git a/.local/bin/leave b/.local/bin/leave new file mode 100755 index 0000000..3f1b24f --- /dev/null +++ b/.local/bin/leave @@ -0,0 +1,18 @@ +#! /usr/bin/sh + +listopts() { + echo "⏼ Shut down" + echo "⟲ Reboot" + echo "🚪 Log out" +} + +option=$(listopts | fuzzel --dmenu) + +case "${option}" in + "⏼ Shut down") + systemctl poweroff;; + "⟲ Reboot") + systemctl reboot;; + "🚪 Log out") + swaymsg exit;; +esac