Add new scripts
Signed-off-by: Severin Kaderli <severin.kaderli@gmail.com>
This commit is contained in:
parent
7721996115
commit
50042dc9c0
11 changed files with 95 additions and 35 deletions
|
@ -7,36 +7,36 @@
|
|||
# Severin Kaderli <severin.kaderli@gmail.com>
|
||||
#
|
||||
# DESCRIPTION:
|
||||
# Displays a power menu using zenity.
|
||||
# Displays a power menu using rofi.
|
||||
#
|
||||
# USAGE:
|
||||
# ./power.sh
|
||||
|
||||
TEXT="Choose action"
|
||||
WIDTH=400
|
||||
HEIGHT=300
|
||||
# The rofi prompt
|
||||
PROMPT="Power Options"
|
||||
|
||||
# Actions for the menu
|
||||
ACTIONS=(
|
||||
"Reboot"
|
||||
"Shutdown"
|
||||
"Performance Mode"
|
||||
"Powersave Mode"
|
||||
"1: Reboot"
|
||||
"2: Shutdown"
|
||||
"3: Performance Mode"
|
||||
"4: 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
|
||||
|
||||
SELECTION=$(printf '%s\n' "${ACTIONS[@]}" | rofi -dmenu -p "${PROMPT}" | cut -d ":" -f1)
|
||||
case "${SELECTION}" in
|
||||
"1")
|
||||
systemctl reboot
|
||||
;;
|
||||
"2")
|
||||
systemctl poweroff
|
||||
;;
|
||||
"3")
|
||||
gksudo "cpupower frequency-set -g performance"
|
||||
optirun -b primus nvidia-settings -a '[gpu:0]/GPUPowerMizerMode=2' -c :8 > /dev/null
|
||||
;;
|
||||
"4")
|
||||
gksudo "cpupower frequency-set -g powersave"
|
||||
optirun -b primus nvidia-settings -a '[gpu:0]/GPUPowerMizerMode=0' -c :8 > /dev/null
|
||||
;;
|
||||
esac
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue