Add power menu to polybar

Signed-off-by: Severin Kaderli <severin.kaderli@gmail.com>
This commit is contained in:
Severin Kaderli 2018-12-24 19:16:28 +01:00
parent 7bf11a5cdb
commit 6270596a5d
Signed by: severinkaderli
GPG key ID: F419F8835B72F0C4
5 changed files with 50 additions and 10 deletions

33
system/bin/power.sh Executable file
View file

@ -0,0 +1,33 @@
#!/bin/bash
#
# SCRIPT NAME:
# power.sh
#
# AUTHOR:
# Severin Kaderli <severin.kaderli@gmail.com>
#
# DESCRIPTION:
# Displays a power menu using zenity.
#
# USAGE:
# ./power.sh
TEXT="Choose action"
WIDTH=400
HEIGHT=200
ACTIONS=(
"Reboot"
"Shutdown"
)
action=$(zenity --list --width="${WIDTH}" --height="${HEIGHT}" --text="${TEXT}" --column="Action" "${ACTIONS[@]}")
echo "$action"
if [ "${action}" == "Reboot" ]
then
systemctl reboot
elif [ "${action}" == "Shutdown" ]
then
systemctl poweroff
fi