#!/usr/bin/env bash # powermenu.sh — Rose Pine Rofi power menu (lock / logout / suspend / reboot / shutdown). # Bound to super+shift+e and the Polybar power glyph. Destructive actions confirm first. set -eu lock=" lock" logout=" logout" suspend=" suspend" reboot=" reboot" shutdown=" shutdown" chosen=$(printf '%s\n' "$lock" "$logout" "$suspend" "$reboot" "$shutdown" \ | rofi -dmenu -i -p "power" -theme rose-pine \ -theme-str 'window {width: 260px;} listview {lines: 5;}') confirm() { # $1 = action label ans=$(printf 'no\nyes' | rofi -dmenu -i -p "$1?" -theme rose-pine \ -theme-str 'window {width: 220px;} listview {lines: 2;}') [ "$ans" = "yes" ] } lock_screen() { if command -v betterlockscreen >/dev/null 2>&1; then betterlockscreen -l elif command -v i3lock >/dev/null 2>&1; then i3lock -c 191724 elif command -v xsecurelock >/dev/null 2>&1; then xsecurelock else notify-send "powermenu" "no screen locker installed (i3lock/xsecurelock)" fi } case "$chosen" in "$lock") lock_screen ;; "$logout") confirm "log out" && bspc quit ;; "$suspend") systemctl suspend ;; "$reboot") confirm "reboot" && systemctl reboot ;; "$shutdown") confirm "shutdown" && systemctl poweroff ;; esac