42 lines
918 B
Bash
Executable file
42 lines
918 B
Bash
Executable file
#!/bin/bash
|
|
#
|
|
# SCRIPT NAME:
|
|
# power.sh
|
|
#
|
|
# AUTHOR:
|
|
# Severin Kaderli <severin.kaderli@gmail.com>
|
|
#
|
|
# DESCRIPTION:
|
|
# Displays a power menu using zenity.
|
|
#
|
|
# USAGE:
|
|
# ./power.sh
|
|
|
|
TEXT="Choose action"
|
|
WIDTH=400
|
|
HEIGHT=300
|
|
ACTIONS=(
|
|
"Reboot"
|
|
"Shutdown"
|
|
"Performance Mode"
|
|
"Powersave Mode"
|
|
)
|
|
|
|
action=$(zenity --list --width="${WIDTH}" --height="${HEIGHT}" --text="${TEXT}" --column="Action" "${ACTIONS[@]}")
|
|
|
|
if [ "${action}" == "Reboot" ]
|
|
then
|
|
systemctl reboot
|
|
elif [ "${action}" == "Shutdown" ]
|
|
then
|
|
systemctl poweroff
|
|
elif [ "${action}" == "Performance Mode" ]
|
|
then
|
|
gksudo "cpupower frequency-set -g performance"
|
|
optirun -b primus nvidia-settings -a '[gpu:0]/GPUPowerMizerMode=2' -c :8 > /dev/null
|
|
elif [ "${action}" == "Powersave Mode" ]
|
|
then
|
|
gksudo "cpupower frequency-set -g powersave"
|
|
optirun -b primus nvidia-settings -a '[gpu:0]/GPUPowerMizerMode=0' -c :8 > /dev/null
|
|
fi
|
|
|