[i3blocks config] Enhancements for laptops, Power Profiles

I’m back at i3 (again) and while tinkering I thought I may as well share what I have so far.

Since there is a Power Profiles Daemon these days and it integrates in GNOME and KDE just fine these days, I wanted to at least know what profile is active in i3 Blocks.

So I went ahead and made some modifications that work. But I do think all that is needed will be a rofi menu for switching profiles. I hope to add that later.


#Show the current powerprofile



#A script to show current power profile

current_profile=$(/usr/bin/powerprofilesctl get)
echo "$current_profile"

Maybe this is way too simple to share, but maybe some other laptop users may appreciate this.


So I got the basics working, not pretty yet but works, the menu sorts alphabetically and not in the order its entered in the script.

Adaptations from Powermenu script now called powerprofile-menu

# powerprofilesctl required
 if ! command_exists powerprofilesctl ; then
   exit 1

# menu defined as an associative array
typeset -A menu

# Menu with keys/commands

   [Performance]="powerprofilesctl set performance"
   [ Balanced]="powerprofilesctl set balanced"
   [ Power Saver]="powerprofilesctl set power-saver"
   [ Cancel]=""


The entry in i3 config: config

# Power Profiles menu
bindsym $mod+Shift+p exec ~/.config/i3/scripts/powerprofile-menu


  1. Fix the sorting
  2. Intelligently display available power profiles?
  3. widen menu to display propperly

@joekamprad Can you see if the script can intelligently check what powerprofiles are available and leave out the ones not available?


i was searching for a way to handle profiles already for i3… but your idea is a nice start!
Using rofi or yad will be possible.

1 Like

I was contemplating to modify the Powermenu, but was a bit stunned at the amount of code in there. I’s well commented though.

We could bind the Powerprofiles menu to a key in the config and then be done.

same here would be nice to be able to sort as it is…
Would also be nice to get a validation on successful setting profile :wink:

1 Like

For me the validation is the changing of the profile name in my bar.

The leaf is a nice touch! I don’t know how to make a pull request with the changes, maybe you can implement it in the config. Looks good!

yes this is the best way… i just see you have the blocks part posted already :wink:


#set power-profile

#Show the current power-profile

I can add it to the i3 configs, also it is always nice to see the one contributing it in the commits as if I add it it looks like me contributing it…
But I can add a link to this post in the message.

This is not working here.

Works for me, strange. I’ll check later if the modification is needed for the script to work as intended.

the powermenu script has also ROFI_OPTIONS=(-theme ~/.config/rofi/powermenu.rasi) to use the right theme and settings I add one that works simply changed from powermenu:

1 Like