From 81df3ce17134b5957021ac8a1952f35e7bbca5d1 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Wed, 6 Aug 2025 21:36:07 +0200 Subject: [PATCH] Add basic power profiles setup menu Still need to be able to reveal which is the current profile --- bin/omarchy-menu | 14 +++++++++++++- bin/omarchy-powerprofiles-list | 5 +++++ 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100755 bin/omarchy-powerprofiles-list diff --git a/bin/omarchy-menu b/bin/omarchy-menu index b86e7b71..b40f4065 100755 --- a/bin/omarchy-menu +++ b/bin/omarchy-menu @@ -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 ;; diff --git a/bin/omarchy-powerprofiles-list b/bin/omarchy-powerprofiles-list new file mode 100755 index 00000000..b0b5d82d --- /dev/null +++ b/bin/omarchy-powerprofiles-list @@ -0,0 +1,5 @@ +#!/bin/bash + +powerprofilesctl list | + awk '/^\s*[* ]\s*[a-zA-Z0-9\-]+:$/ { gsub(/^[*[:space:]]+|:$/,""); print }' | + tac