Dots/configs/eww/scripts/powermenu
2023-04-19 11:04:08 +01:00

24 lines
465 B
Bash
Executable file

#!/usr/bin/env bash
rofi_command="rofi -theme ~/.config/rofi/power.rasi -hover-select"
uptime=$(uptime -p | sed -e 's/up //g')
# Options
shutdown="Shutdown"
reboot="Restart"
lock="Lock"
options="$reboot\n$shutdown\n$lock"
chosen="$(echo -e "$options" | $rofi_command -p "Uptime: $uptime" -dmenu -selected-row 0)"
case $chosen in
$shutdown)
systemctl poweroff
;;
$reboot)
systemctl reboot
;;
$lock)
dm-tool lock
;;
esac