#!/bin/bash #---------------------------------------------------------------- # swayexit — Session management for sway on Wayland # # Replaces the old i3exit script (i3/X11-based). # Uses loginctl for session management (systemd-logind). # # Usage: # swayexit lock — lock the screen (swaylock) # swayexit logout — exit sway # swayexit suspend — suspend to RAM # swayexit hibernate — suspend to disk # swayexit reboot — reboot the system # swayexit shutdown — power off the system # # Dependencies: swaylock, systemd (loginctl) #---------------------------------------------------------------- case "$1" in lock) swaylock -f -c 000000 ;; logout) swaymsg exit ;; suspend) swaylock -f -c 000000 & sleep 0.5 systemctl suspend ;; hibernate) swaylock -f -c 000000 & sleep 0.5 systemctl hibernate ;; reboot) systemctl reboot ;; shutdown) systemctl poweroff ;; *) echo "Usage: swayexit {lock|logout|suspend|hibernate|reboot|shutdown}" exit 1 ;; esac