2020-10-11 05:58:58 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
# logout.sh
|
2020-10-16 17:02:28 +00:00
|
|
|
# logout dialogue to be used with a tint2 executor
|
|
|
|
# no arguments prints the power icon with siji font
|
|
|
|
# -p runs the prompt in dmenu
|
|
|
|
# use a sudoers rule with NOPASSWD or a session manager
|
2022-01-15 05:33:32 +00:00
|
|
|
# Derek Stevens <nilix@nilfm.cc>
|
|
|
|
# MIT License
|
2020-10-11 05:58:58 +00:00
|
|
|
|
2020-10-16 17:02:28 +00:00
|
|
|
menu() {
|
2022-03-26 15:10:26 +00:00
|
|
|
dmenu "$@" -p "action >>>" -fn saucecodepronerdfont-9 -l 6 -nb black -nf "#c9c9c9" -sb "#1f9b92" -sf black
|
2020-10-16 17:02:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
printopts() {
|
2021-11-27 05:50:27 +00:00
|
|
|
printf "shutdown\nreboot\nsuspend\nlogout"
|
2020-10-16 17:02:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
handler() {
|
|
|
|
case $1 in
|
|
|
|
shutdown)
|
2020-10-17 02:31:55 +00:00
|
|
|
poweroff
|
|
|
|
;;
|
2020-10-16 17:02:28 +00:00
|
|
|
reboot)
|
2020-10-17 02:31:55 +00:00
|
|
|
reboot
|
|
|
|
;;
|
2020-10-16 17:02:28 +00:00
|
|
|
suspend)
|
2020-10-17 02:31:55 +00:00
|
|
|
zzz
|
|
|
|
;;
|
2020-10-16 17:02:28 +00:00
|
|
|
logout)
|
2022-03-26 15:10:26 +00:00
|
|
|
# if pgrep sddm-helper; then
|
|
|
|
# killall sddm-helper
|
|
|
|
# elif pgrep ryudo; then
|
|
|
|
# killall ryudo
|
|
|
|
# else
|
|
|
|
# killall fluxbox
|
|
|
|
# fi
|
|
|
|
killall Xorg
|
2020-10-17 02:31:55 +00:00
|
|
|
;;
|
2020-10-16 17:02:28 +00:00
|
|
|
hibernate)
|
2020-10-17 02:31:55 +00:00
|
|
|
ZZZ
|
|
|
|
;;
|
2020-10-16 17:02:28 +00:00
|
|
|
*)
|
|
|
|
:
|
|
|
|
esac
|
|
|
|
}
|
|
|
|
|
|
|
|
logoutMenu() {
|
2020-10-17 02:31:55 +00:00
|
|
|
cmd=$(printopts | menu)
|
|
|
|
handler $cmd
|
2020-10-11 05:58:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if [ -z $1 ]; then
|
2020-10-24 04:02:20 +00:00
|
|
|
echo ""
|
2020-10-11 05:58:58 +00:00
|
|
|
|
|
|
|
elif [ "$1" = "-p" ]; then
|
2020-10-16 17:02:28 +00:00
|
|
|
logoutMenu
|
2020-10-11 05:58:58 +00:00
|
|
|
fi
|