45 lines
702 B
Bash
Executable File
45 lines
702 B
Bash
Executable File
#!/usr/bin/env sh
|
|
|
|
ROFI_CONFIG_DIR="$XDG_CONFIG_HOME/rofi/"
|
|
|
|
UPTIME="`uptime -p | sed -e 's/up //g'`"
|
|
|
|
SHUTDOWN=""
|
|
RESTART=""
|
|
LOCK=""
|
|
LOGOUT=""
|
|
WINDOWS=""
|
|
|
|
rofi_cmd(){
|
|
echo -e "$SHUTDOWN\n$WINDOWS\n$RESTART\n$LOGOUT\n$LOCK" | \
|
|
rofi -dmenu \
|
|
-p "Power" \
|
|
-mesg "Uptime: $UPTIME" \
|
|
-theme ${ROFI_CONFIG_DIR}/powermenu.rasi
|
|
}
|
|
|
|
|
|
selection=$(rofi_cmd)
|
|
|
|
case ${selection} in
|
|
$SHUTDOWN)
|
|
systemctl poweroff
|
|
;;
|
|
$RESTART)
|
|
systemctl reboot
|
|
;;
|
|
$LOCK)
|
|
# TODO
|
|
;;
|
|
$LOGOUT)
|
|
if [[ "$XDG_CURRENT_DESKTOP" == 'Hyprland' ]]; then
|
|
hyprctl dispatch exit
|
|
fi
|
|
;;
|
|
$WINDOWS)
|
|
# TODO
|
|
# grub-set-default
|
|
;;
|
|
esac
|
|
|