Skip to content

Instantly share code, notes, and snippets.

@reasonset
Created August 13, 2023 22:30
Show Gist options
  • Save reasonset/51d5b63e32462d9998a19b2b7c356299 to your computer and use it in GitHub Desktop.
Save reasonset/51d5b63e32462d9998a19b2b7c356299 to your computer and use it in GitHub Desktop.
Quick change CPU governor from systray.
#!/bin/zsh
SUDO_COMMAND=pkexec
#SUDO_COMMAND=gksu
#SUDO_COMMAND=kdesu
avilable_governors=($(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors))
#avilable_governors=(powersave performance)
#avilable_governors=(powersave schedutil performance)
governors=()
for i in $avilable_governors
do
governors+=("$i"'!'"$SUDO_COMMAND"' cpupower frequency-set -g '"$i")
done
MENU_COMMAND="${(j:|:)governors}"
yad --notification --image="cpu" --menu="$MENU_COMMAND" --command="zsh -c 'notify-send \$(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor)'"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment