[How To] Switch profiles of power-profiles-daemon automatically on KDE Plasma

Wrote two one-liners to switch profiles of power-profiles-daemon, to be run automatically when power cord gets plugged in and unplugged.
Here’s the repo

Here are the scripts:

filename: performance.sh

#!/bin/sh
#set performance profile through D-bus

powerprofilesctl set performance

filename: power-save.sh

#!/bin/sh
#set performance profile through D-bus

powerprofilesctl set power-saver


  • Store these scripts in ~/bin or /usr/local/bin

  • Make the scripts executable by changing to the folder where the scripts are located and execute:

    sudo chmod 555 *e.sh
    

To use automatically in KDE Plasma:

  1. Go to System Settings
  2. go to Energy Saving
  3. set the power-save.sh script to execute in the On AC Power tab
  4. set the performance.sh script to execute in the On Battery tab
1 Like

Handling of power-profiles-daemon will apparently be integrated in KDE Plasma 5.23, so these scripts should only be necessary for a short while.

1 Like