Announcement

Collapse
No announcement yet.

How to Always Be in Powersaving Mode (for laptops)

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    How to Always Be in Powersaving Mode (for laptops)

    Hey everyone so I've been a Linux user for years and one thing that always bothered me was bad power managment for laptops whether that may be hot harddrives or the laptop going into performace mode when plugged into ac power. Well this script will alleviate some of those problems if you have a laptop. So here is what we will do.

    1. Copy the power saving scripts from '/usr/lib/pm-utils/power.d/' to '/etc/pm/power.d/'
    2. Run my script to change all of the 'false' values to 'disabled' and all of the 'true' values to 'true|false' thus disabling the system to go to performance mode and always staying in power save mode.
    3. Enjoy a cooler laptop!


    Step 1
    To copy the power saving scripts you type:
    Code:
    sudo cp -r /usr/lib/pm-utils/power.d/* /etc/pm/power.d/
    The reason we do this is because the directory /etc/pm/power.d is for us as users to add scripts or modify them to our liking. The original directory is used for a backup in case the system cannot use our modified scripts.

    Step 2
    You could change these scripts manually but why not use a script to do it instead? All my script does is look for "false)" and change is to "disabled)" and then change the "true)" to "true|false)". The reason behind this is each script is run with the parameter 'script true' or 'script false' when the system goes from power saving mode or to performance mode. We don't want the system to go to performance mode so we can disable the 'script false' statement by replacing 'disabled' into the statement.

    Code:
    #!/bin/bash
    #--- Purpose is to modify pm-utils scripts to never go into 
    #--- performance mode and always stay in powersave mode
    
    # if [find 'false']
    #    change to 'disabled'
    # if [find 'true']
    #    change to 'true|false'
    
    folder=/etc/pm/power.d/
    
    for file in $(find $folder -name "*")
    do
       sed -i s/"[^|]false)"/" disabled)"/g $file
       sed -i s/"true)"/"true|false)"/g $file
    done
    Step 3
    Enjoy a cooler laptop! Also if you use KDE I've noticed a significant difference in performance with KDE 4.8.

    Also to enjoy more power tips go to http://www.kubuntuforums.net/showthr...ighlight=power

    #2
    Hey, neat idea! That fixes the issue where switching between battery and AC undoes the settings my script sets up.

    Comment


      #3
      If you want a little more control, you can install Jupiter (http://www.jupiterapplet.org/ ). It provides a taskbar applet to control performance settings to extend battery life. Originally for the eeePC, it now is supposed to work with all laptops.

      Comment


        #4
        Originally posted by vw72 View Post
        If you want a little more control, you can install Jupiter (http://www.jupiterapplet.org/ ). It provides a taskbar applet to control performance settings to extend battery life. Originally for the eeePC, it now is supposed to work with all laptops.
        I thought about that, especially since Andrew Wyatt ditched Mono and rewrote the thing in Python. But, alas, the binaries in WebUpd8's PPA are compiled only for i386; I don't want to pull in all of ia32-libs just for that.

        Comment


          #5
          I've used Jupiter before but I could never find where it stored the scripts that it ran when you changed the power profiles. With this method I know what will happen and don't usually need to ever come out of powersave mode.

          Comment

          Working...
          X