Skip to content

Instantly share code, notes, and snippets.

@UndeadDevel
Created January 29, 2024 19:42
Show Gist options
  • Save UndeadDevel/6847c10f091dd05f4d70f436070daf22 to your computer and use it in GitHub Desktop.
Save UndeadDevel/6847c10f091dd05f4d70f436070daf22 to your computer and use it in GitHub Desktop.
QubesOS: Switch between CPU governors
#!/bin/bash
# valid values: 0-255, lower means more performance-leaning
PERF=24
BAL=128 # don't modify this value without uncommenting the xenpm command below the first if-clause
PS=223
CUR_VAL=$(xenpm get-cpufreq-para | grep -E -m 1 -o energy_perf\ \[[0-9]+\] | tr -dc '0-9')
if [ "$CUR_VAL" -lt "$BAL" ]; then
xenpm set-cpufreq-hwp balance
#xenpm set-cpufreq-hwp energy-perf:$BAL
notify-send "CPU: Balanced"
elif [ "$CUR_VAL" -eq "$BAL" ]; then
xenpm set-cpufreq-hwp energy-perf:$PS
notify-send "CPU: Power saving"
else
xenpm set-cpufreq-hwp energy-perf:$PERF
notify-send "CPU: Performance"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment