Hello all - after the warm welcome few days ago I would like to share a little tweak which maybe is obvious to most people but maybe it helps others. I would also like to know any alternatives just out of curiosity.
My Laptop: Lenovo Yoga Slim 7
- AMD Ryzen 7 4800u + 16GB RAM + 1TB SSD
- Endeavour OS Plasma / KDE
Goal: easy switch between power states performance
and powersave
as user with a shortcut.
- install
cpupower
- create 2 scripts and place them into ~/.local/bin or any other suitable place for you, make them executable.
cpu_performance.sh
#!/bin/bash
#set CPU to performance mode
sudo cpupower frequency-set -g performance
cpu_powersave.sh
#!/bin/bash
#set CPU to powersave mode
sudo cpupower frequency-set -g powersave
To allow the user to switch power settings without being asked for the sudo password you would need to add following lines to /etc/soduers
# allow user USER to run sudo command without password
USER ALL = NOPASSWD: /usr/bin/cpupower *
change USER to your user name of course.
Now you have got everything prepared to either create a shortcut key to trigger the scripts or as I did start the scripts when changing Activities in KDE.
To let a script run when changing Activities you can go to
KDE system settings → Energy settings → Activity Power settings
in which you need to enable the advanced mode. In there you find the possibility to start the scripts.
Now I have got 2 Activities: One called “Office” and runs in powersave
mode, the other Activity is called “Power” and runs in performance
mode. As per KDE default settings the switch between both is done with Super
+Tab
Feel free to comment so we can get even better functionality.
Cheers!