Files
dotfiles/hypr/scripts/cpufreq.sh
Nikolai Papin 4e688c7c83 feat: autofreeze script for swww when window is selected + a toggle;
refactor: cpufreq does not save notifications anymore;
feat: 3GHz option for cpufreq;
feat: Script for controlling power profile + bind;
refactor: removed hyprpaper, replaced with swww;
refactor: no longer affecting border radius in gamemode;
fix: grayscale filter;
feat: toggle automatic wallpaper switching;
2025-10-05 15:29:30 +03:00

66 lines
1.2 KiB
Bash
Executable File

#!/bin/sh
CURRENT=$(sudo cpupower frequency-info | grep 'current policy: frequency should be within 400 MHz and' | awk '{printf "%.2f%s", $10, substr($11, 1, length($11)-1)}')
set_cmd() {
sudo cpupower frequency-set --max $1MHz
notify-send --hint int:transient:1 -t 800 "$1MHz CPU Power"
}
if [ -z "$1" ]; then
if [ $CURRENT = "400.00MHz" ]; then
set_cmd 600
exit 0
fi
if [ $CURRENT = "600.00MHz" ]; then
set_cmd 1000
exit 0
fi
if [ $CURRENT = "1000.00MHz" ]; then
set_cmd 2000
exit 0
fi
if [ $CURRENT = "2.00GHz" ]; then
set_cmd 3000
exit 0
fi
if [ $CURRENT = "3.00GHz" ]; then
set_cmd 4200
exit 0
fi
if [ $CURRENT = "4.20GHz" ]; then
set_cmd 400
exit 0
fi
else
if [ "$1" = "g" ]; then
case $CURRENT in
"400.00MHz") echo 1 ;;
"600.00MHz") echo 2 ;;
"1000.00MHz") echo 3 ;;
"2.00GHz") echo 4 ;;
"3.00GHz") echo 5 ;;
"4.20GHz") echo 6 ;;
*) echo "Unknown frequency" ;;
esac
exit 0
fi
case $1 in
1) set_cmd 400 ;;
2) set_cmd 600 ;;
3) set_cmd 1000 ;;
4) set_cmd 2000 ;;
5) set_cmd 3000 ;;
6) set_cmd 4200 ;;
esac
exit 0
fi
notify-send --hint int:transient:1 CPU-Power Error: value is $CURRENT
exit 1