45 lines
746 B
Bash
Executable File
45 lines
746 B
Bash
Executable File
#!/usr/bin/env sh
|
|
|
|
ROFI_CONFIG_DIR="$XDG_CONFIG_HOME/rofi/"
|
|
|
|
UPTIME="$(uptime | awk -F'( |,|:)+' '{print $6,$7",",$8,"hours,",$9,"minutes."}')"
|
|
|
|
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)
|
|
boot-windows
|
|
systemctl reboot
|
|
;;
|
|
esac
|
|
|