zenUtils/logout.sh

60 lines
974 B
Bash
Raw Normal View History

#!/bin/sh
# logout.sh
# 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
# Derek Stevens <nilix@nilfm.cc>
# MIT License
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
}
printopts() {
2021-11-27 05:50:27 +00:00
printf "shutdown\nreboot\nsuspend\nlogout"
}
handler() {
case $1 in
shutdown)
poweroff
;;
reboot)
reboot
;;
suspend)
zzz
;;
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
;;
hibernate)
ZZZ
;;
*)
:
esac
}
logoutMenu() {
cmd=$(printopts | menu)
handler $cmd
}
if [ -z $1 ]; then
echo ""
elif [ "$1" = "-p" ]; then
logoutMenu
fi