28 lines
625 B
Bash
Executable File
28 lines
625 B
Bash
Executable File
#!/usr/bin/env bash
|
|
# rofi-power-menu: logout / restart / shutdown via rofi
|
|
|
|
set -euo pipefail
|
|
|
|
awesome-client 'show_dim()' >/dev/null 2>&1
|
|
trap 'awesome-client "hide_dim()" >/dev/null 2>&1' EXIT
|
|
|
|
options=" Logout\n Restart\n Shutdown"
|
|
|
|
chosen=$(echo -e "$options" | rofi -dmenu -i -p "Power" -markup-rows \
|
|
-theme-str 'listview { lines: 3; }' \
|
|
-theme-str 'window { height: 240px; }')
|
|
|
|
[ -z "$chosen" ] && exit 0
|
|
|
|
case "$chosen" in
|
|
*Logout*)
|
|
loginctl terminate-session ${XDG_SESSION_ID-}
|
|
;;
|
|
*Restart*)
|
|
loginctl reboot
|
|
;;
|
|
*Shutdown*)
|
|
loginctl poweroff
|
|
;;
|
|
esac
|