dotfiles/system/.local/bin/power
Severin Kaderli 052fb6bada
Update a bunch of configs
Signed-off-by: Severin Kaderli <severin@kaderli.dev>
2019-03-26 20:22:01 +01:00

50 lines
1,001 B
Bash
Executable file

#!/usr/bin/env bash
#
# SCRIPT NAME:
# power
#
# AUTHOR:
# Severin Kaderli <severin@kaderli.dev>
#
# DESCRIPTION:
# Displays a power menu using rofi.
#
# USAGE:
# ./power
# The rofi prompt
PROMPT="Power Options"
# Actions for the menu
ACTIONS=(
"1: Reboot"
"2: Shutdown"
"3: Suspend"
"4: Lock Screen"
"5: Performance Mode"
"6: Powersave Mode"
)
SELECTION=$(printf '%s\n' "${ACTIONS[@]}" | rofi -dmenu -p "${PROMPT}" | cut -d ":" -f1)
case "${SELECTION}" in
"1")
systemctl reboot
;;
"2")
systemctl poweroff
;;
"3")
systemctl suspend
;;
"4")
screenlock
;;
"5")
gksudo "cpupower frequency-set -g performance"
optirun -b primus nvidia-settings -a '[gpu:0]/GPUPowerMizerMode=2' -c :8 > /dev/null
;;
"6")
gksudo "cpupower frequency-set -g powersave"
optirun -b primus nvidia-settings -a '[gpu:0]/GPUPowerMizerMode=0' -c :8 > /dev/null
;;
esac