converted from terminal-based to dmenu-based
This commit is contained in:
parent
fc24a213d9
commit
eb51bc0e91
1 changed files with 34 additions and 38 deletions
68
logout.sh
68
logout.sh
|
@ -1,50 +1,46 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
# logout.sh
|
# logout.sh
|
||||||
# logout dialogue in three parts to be used with a tint2 executor
|
# logout dialogue to be used with a tint2 executor
|
||||||
# without arguments displays the power symbol in the executor
|
# no arguments prints the power icon with siji font
|
||||||
# -w calls the terminal window with another instance using...
|
# -p runs the prompt in dmenu
|
||||||
# -p to draw and process the prompt
|
# use a sudoers rule with NOPASSWD or a session manager
|
||||||
# use a sudoers rule with NOPASSWD to bypass password entry when using -p
|
# copyleft 2020 Derek Stevens <drkste@zoho.com>
|
||||||
# (c) 2020 Derek Stevens <drkste@zoho.com>
|
|
||||||
# MIT License -- do whatever you want
|
# MIT License -- do whatever you want
|
||||||
|
|
||||||
logoutPrompt() {
|
menu() {
|
||||||
echo "Power and session controls:"
|
dmenu "$@" -p "action >>>" -fn lucidatypewriter-9 -l 6 -nb black -nf grey50 -sb "#1f9b92" -sf black
|
||||||
echo "[s] shutdown"
|
}
|
||||||
echo "[r] reboot"
|
|
||||||
echo "[h] hibernate"
|
|
||||||
echo "[l] logout"
|
printopts() {
|
||||||
read operation
|
printf "shutdown\nreboot\nsuspend\nhibernate\nlogout"
|
||||||
case ${operation} in
|
}
|
||||||
s|S|shutdown|Shutdown|SHUTDOWN)
|
|
||||||
poweroff
|
handler() {
|
||||||
;;
|
case $1 in
|
||||||
r|R|reboot|Reboot|REBOOT)
|
shutdown)
|
||||||
reboot
|
poweroff;;
|
||||||
;;
|
reboot)
|
||||||
h|H|hibernate|Hibernate|HIBERNATE)
|
reboot;;
|
||||||
zzz
|
suspend)
|
||||||
;;
|
zzz;;
|
||||||
l|L|logout|Logout|LOGOUT)
|
logout)
|
||||||
pkill -9 -P $(pgrep .kwin-session)
|
pkill -9 -P $(pgrep .kwin-session);;
|
||||||
;;
|
hibernate)
|
||||||
|
ZZZ;;
|
||||||
*)
|
*)
|
||||||
clear
|
:
|
||||||
logoutPromopt
|
|
||||||
;;
|
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
|
logoutMenu() {
|
||||||
|
printopts | menu | handler
|
||||||
|
}
|
||||||
|
|
||||||
if [ -z $1 ]; then
|
if [ -z $1 ]; then
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
elif [ "$1" = "-w" ]; then
|
|
||||||
|
|
||||||
if ! wmctrl -l | grep "Session Control"; then
|
|
||||||
exec alacritty -d 30 5 --position 9999 0 -t "Session Control" -e sudo ${HOME}/src/zenUtils/logout.sh -p &
|
|
||||||
fi
|
|
||||||
|
|
||||||
elif [ "$1" = "-p" ]; then
|
elif [ "$1" = "-p" ]; then
|
||||||
logoutPrompt
|
logoutMenu
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in a new issue