simple logout script for the kwin+tint2+xfdesktop session

This commit is contained in:
Iris Lightshard 2020-10-11 01:58:58 -04:00
parent 421f271e86
commit d1f1546a0d
Signed by: Iris Lightshard
GPG key ID: 3B7FBC22144E6398

49
logout.sh Executable file
View file

@ -0,0 +1,49 @@
#!/bin/sh
# logout.sh
# logout dialogue in three parts to be used with a tint2 executor
# without arguments displays the power symbol in the executor
# -w calls the terminal window with another instance using...
# -p to draw and process the prompt
# use a sudoers rule with NOPASSWD to bypass password entry when using -p
# (c) 2020 Derek Stevens <drkste@zoho.com>
# MIT License -- do whatever you want
logoutPrompt() {
echo "Power and session controls:"
echo "[s] shutdown"
echo "[r] reboot"
echo "[h] hibernate"
echo "[l] logout"
read operation
case ${operation} in
s|S|shutdown|Shutdown|SHUTDOWN)
poweroff
;;
r|R|reboot|Reboot|REBOOT)
reboot
;;
h|H|hibernate|Hibernate|HIBERNATE)
zzz
;;
l|L|logout|Logout|LOGOUT)
pkill -9 -P $(pgrep .kwin-session)
;;
*)
clear
logoutPromopt
;;
esac
}
if [ -z $1 ]; then
echo ""
elif [ "$1" = "-w" ]; then
if ! wmctrl -l | grep "Session Control"; then
exec alacritty -d 30 5 -t "Session Control" -e sudo ${HOME}/src/zenUtils/logout.sh -p &
fi
elif [ "$1" = "-p" ]; then
logoutPrompt
fi