25 lines
570 B
Bash
Executable File
25 lines
570 B
Bash
Executable File
#!/usr/bin/env bash
|
|
# rofi-power-menu: logout / restart / shutdown via rofi
|
|
|
|
set -euo pipefail
|
|
|
|
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*)
|
|
awesome-client "awesome.quit()" 2>/dev/null || echo "awesome.quit()" | awesome-client
|
|
;;
|
|
*Restart*)
|
|
loginctl reboot
|
|
;;
|
|
*Shutdown*)
|
|
loginctl poweroff
|
|
;;
|
|
esac
|