The sample script that the documentation suggests to switch runlevels when the power cable is plugged/unplugged could be made a bit more generic in my opinion: I mainly use two softlevels (one for X, one for booting into a the console). As such, the script pmg_switch_runlevel.sh won't do in my case. The update I suggest: - does not make any assumption on the number of softlevels a user may want to tweak for ACPI, - simply requires that if a softlevel (used on AC) needs to be changed when going to battery mode, the softlevel should have the same name suffixed with "_battery". For example, I use softlevels "default" and "terminal", I created "default_battery" and "terminal_battery" that are selected when unplugging the power cable. Reproducible: Always An other remark: the documentation shows a sample kernel configuration where the "ACPI Processor P-States driver" is compiled as a module. However I don't think it is mentionned that in this case, it is required to add the module acpi_cpufreq to /etc/modules.autoload.d/kernel-2.*
Created attachment 140571 [details] Updated version of the suggested script
While it's great that you can tweak the script, that's too specific for your system, and it would be a detriment to the majority of users reading this guide. For most users, two levels, AC and battery, are sufficient. I'll think about it s'more, though.
In my opinion, on the contrary, the version I propose is more general since it will work for people who use a single runlevel and for those who use more like me, whereas the version proposed in the current guide will only work for the former. As a user who wants to configure his Gentoo box, I expect to go reading the power management guide, follow the instructions and have the stuff work. No matter how good the current guide is (and it is), I had to do some more work to have ACPI working (ok, not a big job, but still :-) ): the script I suggest is one more step toward zero-headache condiguration... Anyway, it is up to you to decide.
Given that OpenRC is the future of Gentoo, and its constant flux, I'm reluctant to add this, since the softlevel stuff keeps shifting around. Maintaining the script could be a bit of a pain. But thanks for the idea; it is pretty creative!