aboutsummaryrefslogtreecommitdiff
path: root/.local/bin/script/dmenu-cpu
blob: c5b435c1cd33164efcc226c17b71f48b89720250 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
#!/bin/sh

ANS="$(printf "powersave\nperformance" | dmenu -i -p "CPU ($(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor))")"
case "$ANS" in
	powersave|performance) ;;
	*) exit 1
esac

# I don't know how to pass a password to sudo without using pipes.
# We can't use pipes because we need to pipe performance mode to it.

dmenu -P -p "Password" | sudo -S true
echo "$ANS" | sudo tee /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor