Friday, November 24, 2006

KPowersave config tutorial

As wrote in my last post about the current KPowersave release 0.7.1 there are some settings which the user can't change at the moment via the configure dialog. Here now a small tutorial how to control this settings via the KPowersave config file.

You can control the settings for these options:
  • battery warning levels
  • actions for battery warning levels and lidclose
  • default AC and battery scheme
  • CPU frequency policy for each scheme
To change the config keys for these options you need to open in your home with a editor of your choise this file (if the file is not present, create the file): ~/.kde/share/config/kpowersaverc

KPowersave provide three different battery warning levels: warning, low and critical. To define the percentage (between 0 and 100) of battery fill for these levels you need to edit config keys in the section [General]. If the section is not there, simply add a line with [General] at top of the file and add/edit these keys there :
batteryWarning=12
batteryLow=7
batteryCritical=2
You can also define a action (currently only one per level) which is called if one of the battery warning levels reached. The available actions are:
  • shutdown the machine (SHUTDOWN)
  • suspend to disk (SUSPEND2DISK)
  • suspend to ram (SUSPEND2RAM)
  • change the CPU freqency policy to 'performance' (CPUFREQ_POWERSAVE) or 'dynamic' (CPUFREQ_DYNAMIC)
  • change the brightness if supported by your hardware (BRIGHTNESS)
To define the actions for the battery warning levels you have to change this keys (also in the section [General]):
batteryWarningAction=
batteryLowAction=BRIGHTNESS
batteryCriticalAction=SHUTDOWN
The values in this example are the already defined defaults, so you don't need to add/change the keys if this is what you want. For the action BRIGHTNESS you need an additional key for each level to define the level (in percentage) of brightness to set:
batteryWarningActionValue=
batteryLowActionValue=
batteryCriticalActionValue=
You can use the same actions and values as for battery warning levels also for the event if the lid of your laptop get closed. To control the behavior you need to change these keys:
ActionOnLidClose=
ActionOnLidCloseValue=
To control which scheme KPowersave should use on battery or on AC you need to know the names of the available schemes. You can find them in this file: /opt/kde3/share/config/kpowersaverc . Currently there are (excluding the [default-scheme]) these schemes per default: Performance, Powersave, Presentation and Acoustic. To set the schemes you have to change these keys:
ac_scheme=Performance
battery_scheme=Powersave
At least you can change the CPU frequency for each scheme. For this you need, if not already there, for each a own section in the config file (a section starts with the name of the scheme withing '[ ]'). The available CPU frequency policies are: PERFORMANCE, POWERSAVE and DYNAMIC. Here a example for the performance scheme:
[Performance]
cpuFreqPolicy=DYNAMIC
If you canged all you want, you need to restart KPowersave to apply the changes.