dotfiles/dot_config/sway/executable_swayexit-openrc

35 lines
1.3 KiB
Text
Raw Permalink Normal View History

2023-01-30 14:28:59 +01:00
#!/bin/sh
lock() {
i3lock
}
case "$1" in
lock)
swaylock -c 000000
;;
logout)
killall sway
;;
suspend)
echo -n mem | sudo tee --append /sys/power/state
#lock && dbus-send --system --print-reply --type=method_call --reply-timeout=2000 --dest=org.freedesktop.UPower /org/freedesktop/UPower org.freedesktop.UPower.Suspend
;;
hibernate)
echo -n disk | sudo tee --append /sys/power/state
#lock && dbus-send --system --print-reply --type=method_call --reply-timeout=2000 --dest=org.freedesktop.UPower /org/freedesktop/UPower org.freedesktop.UPower.Hibernate
;;
reboot)
sudo openrc-shutdown --reboot now
#dbus-send --system --print-reply --type=method_call --reply-timeout=2000 --dest=org.freedesktop.ConsoleKit /org/freedesktop/ConsoleKit/Manager org.freedesktop.ConsoleKit.Manager.Restart
;;
shutdown)
sudo openrc-shutdown --poweroff now
#dbus-send --system --print-reply --type=method_call --reply-timeout=2000 --dest=org.freedesktop.ConsoleKit /org/freedesktop/ConsoleKit/Manager org.freedesktop.ConsoleKit.Manager.Stop
;;
*)
echo "Usage: $0 {lock|logout|suspend|hibernate|reboot|shutdown}"
exit 2
esac
exit 0