From 13382f42fa6e5f84ab1d47d1544cd94f9a7dfe2a Mon Sep 17 00:00:00 2001 From: Henrik Bakken Date: Wed, 7 Oct 2026 13:28:15 +0200 Subject: [PATCH] sway tweaks --- CONFIG/sway/config | 10 +++--- CONFIG/sway/scripts/power_menu.sh | 51 ++++++++++++++++++------------- 2 files changed, 33 insertions(+), 28 deletions(-) diff --git a/CONFIG/sway/config b/CONFIG/sway/config index 792d9be..26f9cee 100644 --- a/CONFIG/sway/config +++ b/CONFIG/sway/config @@ -69,7 +69,7 @@ set $powermenu ~/.config/sway/scripts/power_menu.sh # ------------------------------------------ # Launch the terminal bindsym $mod+Return exec $term -bindsym Mod4+Shift+Return exec foot bash +bindsym $mod+Shift+Return exec foot bash # Kill focused window bindsym $mod+Shift+q kill # Lock screen @@ -294,11 +294,10 @@ exec hash dbus-update-activation-environment 2>/dev/null && \ # Idle configuration exec swayidle -w \ - timeout 1200 'pgrep -x gtklock || gtklock -d' \ + timeout 1200 'gtklock -d' \ timeout 2400 'swaymsg "output * power off"' resume 'swaymsg "output * power on"' \ - before-sleep 'pgrep -x gtklock || gtklock -d' \ - after-resume 'swaymsg reload' \ - idlehint 240 + timeout 10 'if pgrep -x gtklock; then swaymsg "output * power off"; fi' \ + before-sleep 'gtklock -d' # Start foot server exec systemctl --user enable --now foot-server.service @@ -393,4 +392,3 @@ input type:mouse { accel_profile "flat" pointer_accel 0.5 } - diff --git a/CONFIG/sway/scripts/power_menu.sh b/CONFIG/sway/scripts/power_menu.sh index 34a1a32..66e4cdb 100755 --- a/CONFIG/sway/scripts/power_menu.sh +++ b/CONFIG/sway/scripts/power_menu.sh @@ -1,6 +1,7 @@ #!/bin/bash SELECTION="$(printf "󰌾 Lock\n󰤄 Suspend\n󰍃 Log out\n Reboot\n Reboot to UEFI\n󰐥 Shutdown" | fuzzel --dmenu -a top-right -l 6 -w 18 -p "Select an option: ")" +[[ -z "$SELECTION" ]] && exit 0 confirm_action() { local action="$1" @@ -9,26 +10,32 @@ confirm_action() { } case $SELECTION in - *"󰌾 Lock"*) - gtklock;; - *"󰤄 Suspend"*) - if confirm_action "Suspend"; then - systemctl suspend-then-hibernate - fi;; - *"󰍃 Log out"*) - if confirm_action "Log out"; then - swaymsg exit - fi;; - *" Reboot"*) - if confirm_action "Reboot"; then - systemctl reboot - fi;; - *" Reboot to UEFI"*) - if confirm_action "Reboot to UEFI"; then - systemctl reboot --firmware-setup - fi;; - *"󰐥 Shutdown"*) - if confirm_action "Shutdown"; then - systemctl poweroff - fi;; +*"󰌾 Lock"*) + gtklock + ;; +*"󰤄 Suspend"*) + if confirm_action "Suspend"; then + systemctl suspend-then-hibernate + fi + ;; +*"󰍃 Log out"*) + if confirm_action "Log out"; then + swaymsg exit + fi + ;; +*" Reboot"*) + if confirm_action "Reboot"; then + systemctl reboot + fi + ;; +*" Reboot to UEFI"*) + if confirm_action "Reboot to UEFI"; then + systemctl reboot --firmware-setup + fi + ;; +*"󰐥 Shutdown"*) + if confirm_action "Shutdown"; then + systemctl poweroff + fi + ;; esac