You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
1.1 KiB
46 lines
1.1 KiB
#!/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
|
|
|