Added logout script
This commit is contained in:
33
dmenu/logout.sh
Normal file
33
dmenu/logout.sh
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
args = "'$*' "
|
||||||
|
lines="-l 2"
|
||||||
|
|
||||||
|
first_prompt=""
|
||||||
|
opt1="Restart\nShutdown"
|
||||||
|
opt2="Yes\nNo"
|
||||||
|
|
||||||
|
ask() {
|
||||||
|
answer="$( echo -e $1 | dmenu -i -p "$2" $lines $args )"
|
||||||
|
}
|
||||||
|
|
||||||
|
ask "$opt1" "$first_prompt"
|
||||||
|
|
||||||
|
case $answer in
|
||||||
|
"Restart")
|
||||||
|
ask "$opt2" "Are you sure?"
|
||||||
|
if [[ $answer == "Sim" ]]; then
|
||||||
|
systemctl reboot
|
||||||
|
fi
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
"Shutdown")
|
||||||
|
ask "$opt2" "Are you sure?"
|
||||||
|
if [[ $answer == "Sim" ]]; then
|
||||||
|
systemctl poweroff
|
||||||
|
fi
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
exit 0
|
Reference in New Issue
Block a user