尤其是 cpufreq-selector 這個對 Laptop 很常用的 applet 不能用, 實在很可惜.
所以, 利用 dmenu (part of dwm-tools) 來刻一個簡單的 cpufreq-selector.
ScreenShot:
安裝 dmenu:
sudo apt-get install dwm-tools
撰寫 cpufreq script:
或可以由此下載.
#!/bin/sh
cur_governor=`cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor`
avail_governors=`cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors`
# using dmenu to select cpu governor
cpu_governor=$(for i in $avail_governors ;do
if [ $cur_governor = $i ]; then
echo "[$i]"
else
echo $i
fi
done | dmenu -p "Select CPU Governor: "| sed "s/\[\([a-z|A-Z]*\)\]/\1/g")
if [ -n "$cpu_governor" ]; then
for cpu in `ls -d /sys/devices/system/cpu/cpu?` ; do
cpu_num=`basename $cpu | sed "s/cpu//"`
cpufreq-selector -c $cpu_num -g $cpu_governor
done
fi
關閉 cpufreq-selector 每次必需輸入密碼(如果你覺得煩):
修改 /usr/share/polkit-1/actions/org.gnome.cpufreqselector.policy
gksudo gedit /usr/share/polkit-1/actions/org.gnome.cpufreqselector.policy
找到原始:
<defaults>
<allow_inactive>no</allow_inactive>
<allow_active>auth_admin_keep</allow_active>
</defaults>
修改成:
<defaults>
<allow_inactive>no</allow_inactive>
<allow_active>yes</allow_active>
</defaults>
沒有留言:
張貼留言