chore(scripts): restore i3exit

This partially reverts commit e80aeb96be.
This commit is contained in:
winston 2022-12-09 06:58:37 +01:00
parent 319151ee02
commit a4a0d5e805
Signed by: winston
GPG key ID: 3786770EDBC2B481

View file

@ -0,0 +1,35 @@
#!/bin/sh
# with openrc use loginctl
[ "$(cat /proc/1/comm)" = "systemd" ] && logind=systemctl || logind=loginctl
case "$1" in
lock)
xscreensaver-command -lock
;;
logout)
i3-msg exit
;;
switch_user)
dm-tool switch-to-greeter
;;
suspend)
xscreensaver-command -lock && $logind suspend
;;
hibernate)
xscreensaver-command -lock && $logind hibernate
;;
reboot)
$logind reboot
;;
shutdown)
$logind poweroff
;;
*)
echo "== ! i3exit: missing or invalid argument ! =="
echo "Try again with: lock | logout | switch_user | suspend | hibernate | reboot | shutdown"
exit 2
esac
exit 0