Add basic power profiles setup menu

Still need to be able to reveal which is the current profile
This commit is contained in:
David Heinemeier Hansson 2025-08-06 21:36:07 +02:00
parent 0fcda80630
commit 81df3ce171
2 changed files with 18 additions and 1 deletions

View File

@ -103,7 +103,7 @@ show_toggle_menu() {
}
show_setup_menu() {
local options=" Audio\n Wifi\n󰂯 Bluetooth\n󰍹 Monitors"
local options=" Audio\n Wifi\n󰂯 Bluetooth\n󱐋 Power Profile\n󰍹 Monitors"
[ -f ~/.config/hypr/bindings.conf ] && options="$options\n Keybindings"
[ -f ~/.config/hypr/input.conf ] && options="$options\n Input"
options="$options\n Configs\n󰈷 Fingerprint\n Fido2"
@ -112,6 +112,7 @@ show_setup_menu() {
*Audio*) alacritty --class=Wiremix -e wiremix ;;
*Wifi*) alacritty --class=Impala -e impala ;;
*Bluetooth*) blueberry ;;
*Power*) show_setup_power_menu ;;
*Monitors*) edit_in_nvim ~/.config/hypr/monitors.conf ;;
*Keybindings*) edit_in_nvim ~/.config/hypr/bindings.conf ;;
*Input*) edit_in_nvim ~/.config/hypr/input.conf ;;
@ -122,6 +123,17 @@ show_setup_menu() {
esac
}
show_setup_power_menu() {
current_profile=$(powerprofilesctl get)
new_profile=$(menu "Power Profile" "$($OMARCHY_BIN_PATH/omarchy-powerprofiles-list)" "-a '${current_profile}'")
if [[ "$new_profile" == "CNCLD" || -z "$new_profile" ]]; then
show_main_menu
else
powerprofilesctl set "$new_profile"
fi
}
show_setup_configs_menu() {
case $(menu "Setup" " Hyprland\n Hypridle\n Hyprlock\n Hyprsunset\n Swayosd\n󰌧 Walker\n󰍜 Waybar\n󰞅 XCompose") in
*Hyprland*) edit_in_nvim ~/.config/hypr/hyprland.conf ;;

5
bin/omarchy-powerprofiles-list Executable file
View File

@ -0,0 +1,5 @@
#!/bin/bash
powerprofilesctl list |
awk '/^\s*[* ]\s*[a-zA-Z0-9\-]+:$/ { gsub(/^[*[:space:]]+|:$/,""); print }' |
tac