[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
    or alternatively
    sudo chmod 555 power-save.sh && sudo chmod 555 performance.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

ps. This is a crosspost of mine from Manjaro Linux Forum. Thanks to Manjaro mods for their edits.

2 Likes

Hopefully, this shouldn’t be needed once KDE Plasma 5.23 lands in Fedora, because that includes integration with power-profiles-daemon.

Nice, I didn’t know that. Still a little proud of my small contribution though :slight_smile:
Guess I’ll disable these scripts before upgrading to KDE Plasma 5.23, and let Plasma do its thing.