56 lines
1.5 KiB
Bash
Executable file
56 lines
1.5 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
|
|
# ***This script was made by Clay Gomera (Drake)***
|
|
# - Description: A simple power menu dmenu script
|
|
# - Dependencies: dmenu, power-profiles-daemon
|
|
|
|
## OPTIONS ##
|
|
option1="logout"
|
|
option2="reboot"
|
|
option3="power off"
|
|
option4="suspend"
|
|
option5="lock"
|
|
option6="change power profile"
|
|
option7="cancel"
|
|
|
|
## OPTIONS ARRAY ##
|
|
options="$option1\n$option2\n$option3\n$option4\n$option5\n$option6\n$option7"
|
|
|
|
## POWER PROFILE OPTIONS ##
|
|
pwr1="performance"
|
|
pwr2="balanced"
|
|
pwr3="powersaver"
|
|
pwr4="cancel"
|
|
|
|
## POWER PROFILES ARRAY ##
|
|
pwrs="$pwr1\n$pwr2\n$pwr3\n$pwr4"
|
|
|
|
## MAIN ACTION COMMAND ##
|
|
action=$(echo -e "$options" | dmenu -i -p "power options:")
|
|
case "$action" in
|
|
$option1*)
|
|
pkill X;;
|
|
$option2*)
|
|
systemctl reboot;;
|
|
$option3*)
|
|
systemctl poweroff;;
|
|
$option4*)
|
|
slock systemctl suspend;;
|
|
$option5*)
|
|
slock;;
|
|
$option6*)
|
|
currentpwr=$(powerprofilesctl get)
|
|
pwraction=$(echo -e "$pwrs" | dmenu -i -p "current profile is: ${currentpwr} | select profile:")
|
|
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;;
|
|
$option7*)
|
|
exit 0
|
|
esac
|