2023-02-22 00:02:06 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
# ***This script was made by Clay Gomera (Drake)***
|
|
|
|
# - Description: A simple power menu rofi script
|
2023-03-31 13:35:01 +00:00
|
|
|
# - Dependencies: rofi, power-profiles-daemon, swaylock
|
2023-02-25 16:12:09 +00:00
|
|
|
#
|
|
|
|
|
2023-03-31 13:35:01 +00:00
|
|
|
## MENU PROMPT ##
|
|
|
|
menu="rofi -dmenu -i -p"
|
|
|
|
|
2023-02-25 16:12:09 +00:00
|
|
|
## CURRENT WALLPAPER FOR LOCKSCREEN ##
|
2023-04-24 00:01:47 +00:00
|
|
|
currwall=$(tail --l 1 "$HOME/.wbg" | awk '{print $3}')
|
2023-02-22 00:02:06 +00:00
|
|
|
|
|
|
|
## OPTIONS ##
|
|
|
|
option1=" Logout"
|
|
|
|
option2=" Reboot"
|
|
|
|
option3=" Power off"
|
|
|
|
option4="鈴 Suspend"
|
|
|
|
option5=" Lock"
|
|
|
|
option6=" Change power profile"
|
|
|
|
option7=" Cancel"
|
|
|
|
options="$option1\n$option2\n$option3\n$option4\n$option5\n$option6\n$option7"
|
|
|
|
|
|
|
|
## POWER PROFILE OPTIONS ##
|
|
|
|
pwr1=" Performance"
|
|
|
|
pwr2=" Balanced"
|
|
|
|
pwr3=" Power Saver"
|
|
|
|
pwr4=" Cancel"
|
|
|
|
pwrs="$pwr1\n$pwr2\n$pwr3\n$pwr4"
|
|
|
|
|
|
|
|
## MAIN ACTION COMMAND ##
|
2023-03-31 13:35:01 +00:00
|
|
|
action=$(echo -e "$options" | $menu " Power Options ")
|
2023-02-22 00:02:06 +00:00
|
|
|
case "$action" in
|
2023-04-27 22:58:55 +00:00
|
|
|
$option1)
|
2023-02-22 00:02:06 +00:00
|
|
|
pkill Hyprland;;
|
2023-04-27 22:58:55 +00:00
|
|
|
$option2)
|
2023-02-22 00:02:06 +00:00
|
|
|
systemctl reboot || loginctl reboot;;
|
2023-04-27 22:58:55 +00:00
|
|
|
$option3)
|
2023-02-22 00:02:06 +00:00
|
|
|
systemctl poweroff || loginctl poweroff;;
|
2023-04-27 22:58:55 +00:00
|
|
|
$option4)
|
2023-02-25 16:12:09 +00:00
|
|
|
swaylock -i "$currwall" &
|
2023-02-22 02:09:45 +00:00
|
|
|
sleep 0.1
|
|
|
|
systemctl suspend;;
|
2023-04-27 22:58:55 +00:00
|
|
|
$option5)
|
2023-02-25 16:12:09 +00:00
|
|
|
swaylock -i "$currwall";;
|
2023-04-27 22:58:55 +00:00
|
|
|
$option6)
|
2023-02-22 00:02:06 +00:00
|
|
|
currentpwr=$(powerprofilesctl get)
|
|
|
|
if [ "$currentpwr" = "performance" ]; then
|
|
|
|
currentpwr=" Performance"
|
|
|
|
elif [ "$currentpwr" = "power-saver" ]; then
|
|
|
|
currentpwr=" Power Saver"
|
|
|
|
elif [ "$currentpwr" = "balanced" ]; then
|
|
|
|
currentpwr=" Balanced"
|
|
|
|
fi
|
2023-03-31 13:35:01 +00:00
|
|
|
pwraction=$(echo -e "$pwrs" | $menu " Power Profile Menu - Currently set to: ${currentpwr} ")
|
2023-02-22 00:02:06 +00:00
|
|
|
case "$pwraction" in
|
|
|
|
$pwr1*)
|
|
|
|
powerprofilesctl set performance && notify-send "Power profile switched to performance";;
|
|
|
|
$pwr2*)
|
|
|
|
powerprofilesctl set balanced && notify-send "Power profile switched to balanced";;
|
|
|
|
$pwr3*)
|
|
|
|
powerprofilesctl set power-saver && notify-send "Power profile switched to power saver";;
|
|
|
|
$pwr4*)
|
|
|
|
exit 0
|
|
|
|
esac;;
|
2023-04-27 22:58:55 +00:00
|
|
|
$option7)
|
2023-02-22 00:02:06 +00:00
|
|
|
exit 0
|
|
|
|
esac
|