From c85829dff52c0b3c2f6ecb02b98c1b78050b9c04 Mon Sep 17 00:00:00 2001 From: LMBishop <13875753+LMBishop@users.noreply.github.com> Date: Mon, 17 Jul 2023 02:18:51 +0100 Subject: Add wofi exit menu --- sway/config | 2 +- sway/scripts/exit-menu.sh | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100755 sway/scripts/exit-menu.sh diff --git a/sway/config b/sway/config index 985bf95..330f12f 100644 --- a/sway/config +++ b/sway/config @@ -67,7 +67,7 @@ bindsym $mod+Return exec $term bindsym $mod+Shift+Return exec $term --class="termfloat" bindsym $mod+d exec pgrep -x wofi >/dev/null 2>&1 && killall wofi || $menu bindsym $mod+Shift+c reload -bindsym $mod+Shift+e 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 $mod+Shift+e exec ~/.config/sway/scripts/exit-menu.sh # Politely quit bindsym $mod+q kill diff --git a/sway/scripts/exit-menu.sh b/sway/scripts/exit-menu.sh new file mode 100755 index 0000000..a492df8 --- /dev/null +++ b/sway/scripts/exit-menu.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +entries=" Lock\n󰹆 Suspend\n󰍃 Logout\n󰜉 Reboot\n󰐥 Shutdown" + +selected=$(echo -e $entries|wofi --width 100 --height 185 --dmenu --cache-file /dev/null --define content_halign=center --define prompt="Exit menu" | awk '{print tolower($2)}') + +case $selected in + lock) + swaylock;; + logout) + swaymsg exit;; + suspend) + exec systemctl suspend;; + reboot) + exec systemctl reboot;; + shutdown) + exec systemctl poweroff -i;; +esac -- cgit v1.2.3-70-g09d2