Re: Automatically change processor settings when changing to/from battery on laptop
OnDemand is usually the best CPU governor. Your CPU sleeps when there is nothing to do, then runs slowly when there is only a small load. When there is a large load, the CPU sprints, and then when the load drops it immediately goes back to sleep.
Intel says it is more power efficient to run the CPU fast and complete its work quickly and make it sleep sooner, than it is to run it for longer at a slow pace. Intel also says that the performance gain by using the Performance governor (basically running the CPU at full speed all the time) is nearly immeasurably low.
I don't know what software can change the governor on AC or battery (you could write a simple Bash script maybe?) but from what I understand your idea will hinder battery life, lower performance on battery and not help performance on mains power.
I try to treat the cause, not the symptom. I avoid the terminal in instructions, unless it's easier or necessary. My instructions will work within the Ubuntu system, instead of breaking or subverting it. Those are the three guarantees to the helpee.