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.
~/.config/i3/i3blocks.conf
#Show the current powerprofile
powerprofile]
label=
command=~/.config/i3/scripts/powerprofile
interval=5
~/.config/i3/scripts/powerprofile
#!/bin/bash
#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.
EDIT:
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
fi
# menu defined as an associative array
typeset -A menu
# Menu with keys/commands
menu=(
[Performance]="powerprofilesctl set performance"
[ Balanced]="powerprofilesctl set balanced"
[ Power Saver]="powerprofilesctl set power-saver"
[ Cancel]=""
)
menu_nrows=${#menu[@]}
The entry in i3 config: config
# Power Profiles menu
bindsym $mod+Shift+p exec ~/.config/i3/scripts/powerprofile-menu
TODO:
- Fix the sorting
- Intelligently display available power profiles?
- 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?