From 90013c74516cad19663e67c0f487586cf0f74659 Mon Sep 17 00:00:00 2001 From: Ninjdai Date: Tue, 15 Jul 2025 22:44:24 +0200 Subject: [PATCH 1/4] feat: power-profile switcher in topbar --- .../quickshell/ii/modules/bar/UtilButtons.qml | 33 +++++++++++++++++++ .../quickshell/ii/modules/common/Config.qml | 1 + .../ii/modules/settings/InterfaceConfig.qml | 7 ++-- 3 files changed, 39 insertions(+), 2 deletions(-) diff --git a/.config/quickshell/ii/modules/bar/UtilButtons.qml b/.config/quickshell/ii/modules/bar/UtilButtons.qml index 706ba6f6..f110c943 100644 --- a/.config/quickshell/ii/modules/bar/UtilButtons.qml +++ b/.config/quickshell/ii/modules/bar/UtilButtons.qml @@ -104,5 +104,38 @@ Item { } } } + + Loader { + active: Config.options.bar.utilButtons.showPerfProfileToggle + visible: Config.options.bar.utilButtons.showPerfProfileToggle + sourceComponent: CircleUtilButton { + Layout.alignment: Qt.AlignVCenter + onClicked: event => { + if (PowerProfiles.hasPerformanceProfile) { + switch(PowerProfiles.profile) { + case PowerProfile.PowerSaver: PowerProfiles.profile = PowerProfile.Balanced + break; + case PowerProfile.Balanced: PowerProfiles.profile = PowerProfile.Performance + break; + case PowerProfile.Performance: PowerProfiles.profile = PowerProfile.PowerSaver + break; + } + } else { + PowerProfiles.profile = PowerProfiles.profile == PowerProfile.Balanced ? PowerProfile.PowerSaver : PowerProfile.Balanced + } + } + MaterialSymbol { + horizontalAlignment: Qt.AlignHCenter + fill: 0 + text: switch(PowerProfiles.profile) { + case PowerProfile.PowerSaver: return "battery_saver" + case PowerProfile.Balanced: return "balance" + case PowerProfile.Performance: return "speed" + } + iconSize: Appearance.font.pixelSize.large + color: Appearance.colors.colOnLayer2 + } + } + } } } diff --git a/.config/quickshell/ii/modules/common/Config.qml b/.config/quickshell/ii/modules/common/Config.qml index 582c11d8..ea37b692 100644 --- a/.config/quickshell/ii/modules/common/Config.qml +++ b/.config/quickshell/ii/modules/common/Config.qml @@ -123,6 +123,7 @@ Singleton { property bool showMicToggle: false property bool showKeyboardToggle: true property bool showDarkModeToggle: true + property bool showPerfProfileToggle: false } property JsonObject tray: JsonObject { property bool monochromeIcons: true diff --git a/.config/quickshell/ii/modules/settings/InterfaceConfig.qml b/.config/quickshell/ii/modules/settings/InterfaceConfig.qml index 2d692442..293b6032 100644 --- a/.config/quickshell/ii/modules/settings/InterfaceConfig.qml +++ b/.config/quickshell/ii/modules/settings/InterfaceConfig.qml @@ -164,8 +164,11 @@ ContentPage { } } ConfigSwitch { - opacity: 0 - enabled: false + text: "Performance Profile toggle" + checked: Config.options.bar.utilButtons.showPerfProfileToggle + onCheckedChanged: { + Config.options.bar.utilButtons.showPerfProfileToggle = checked; + } } } } From 365a64977635460dc36419c6c6cea2c0111d35e1 Mon Sep 17 00:00:00 2001 From: Ninjdai <65647523+Ninjdai1@users.noreply.github.com> Date: Wed, 16 Jul 2025 10:31:49 +0200 Subject: [PATCH 2/4] Update UtilButtons.qml --- .config/quickshell/ii/modules/bar/UtilButtons.qml | 1 + 1 file changed, 1 insertion(+) diff --git a/.config/quickshell/ii/modules/bar/UtilButtons.qml b/.config/quickshell/ii/modules/bar/UtilButtons.qml index f110c943..7297f886 100644 --- a/.config/quickshell/ii/modules/bar/UtilButtons.qml +++ b/.config/quickshell/ii/modules/bar/UtilButtons.qml @@ -6,6 +6,7 @@ import Quickshell import Quickshell.Io import Quickshell.Hyprland import Quickshell.Services.Pipewire +import Quickshell.Services.UPower Item { id: root From 05fdbf3d24aee448810cc9513c7745e8e49d992f Mon Sep 17 00:00:00 2001 From: end-4 <97237370+end-4@users.noreply.github.com> Date: Fri, 25 Jul 2025 13:58:40 +0700 Subject: [PATCH 3/4] rename showPerfProfileToggle -> showPerformanceProfileToggle --- .config/quickshell/ii/modules/bar/UtilButtons.qml | 8 ++++---- .config/quickshell/ii/modules/common/Config.qml | 2 +- .../quickshell/ii/modules/settings/InterfaceConfig.qml | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.config/quickshell/ii/modules/bar/UtilButtons.qml b/.config/quickshell/ii/modules/bar/UtilButtons.qml index 7297f886..93c26e9c 100644 --- a/.config/quickshell/ii/modules/bar/UtilButtons.qml +++ b/.config/quickshell/ii/modules/bar/UtilButtons.qml @@ -1,5 +1,5 @@ -import "root:/modules/common" -import "root:/modules/common/widgets" +import qs.modules.common +import qs.modules.common.widgets import QtQuick import QtQuick.Layouts import Quickshell @@ -107,8 +107,8 @@ Item { } Loader { - active: Config.options.bar.utilButtons.showPerfProfileToggle - visible: Config.options.bar.utilButtons.showPerfProfileToggle + active: Config.options.bar.utilButtons.showPerformanceProfileToggle + visible: Config.options.bar.utilButtons.showPerformanceProfileToggle sourceComponent: CircleUtilButton { Layout.alignment: Qt.AlignVCenter onClicked: event => { diff --git a/.config/quickshell/ii/modules/common/Config.qml b/.config/quickshell/ii/modules/common/Config.qml index 047b8948..339596a6 100644 --- a/.config/quickshell/ii/modules/common/Config.qml +++ b/.config/quickshell/ii/modules/common/Config.qml @@ -124,7 +124,7 @@ Singleton { property bool showMicToggle: false property bool showKeyboardToggle: true property bool showDarkModeToggle: true - property bool showPerfProfileToggle: false + property bool showPerformanceProfileToggle: false } property JsonObject tray: JsonObject { property bool monochromeIcons: true diff --git a/.config/quickshell/ii/modules/settings/InterfaceConfig.qml b/.config/quickshell/ii/modules/settings/InterfaceConfig.qml index 293b6032..3f8be496 100644 --- a/.config/quickshell/ii/modules/settings/InterfaceConfig.qml +++ b/.config/quickshell/ii/modules/settings/InterfaceConfig.qml @@ -165,9 +165,9 @@ ContentPage { } ConfigSwitch { text: "Performance Profile toggle" - checked: Config.options.bar.utilButtons.showPerfProfileToggle + checked: Config.options.bar.utilButtons.showPerformanceProfileToggle onCheckedChanged: { - Config.options.bar.utilButtons.showPerfProfileToggle = checked; + Config.options.bar.utilButtons.showPerformanceProfileToggle = checked; } } } From 32f94704c7492f7b9b63f66f33229a9b8e628e59 Mon Sep 17 00:00:00 2001 From: end-4 <97237370+end-4@users.noreply.github.com> Date: Fri, 25 Jul 2025 14:10:55 +0700 Subject: [PATCH 4/4] bar: power profiles: change icon for "balanced" --- .config/quickshell/ii/modules/bar/UtilButtons.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.config/quickshell/ii/modules/bar/UtilButtons.qml b/.config/quickshell/ii/modules/bar/UtilButtons.qml index 93c26e9c..a1afd7d8 100644 --- a/.config/quickshell/ii/modules/bar/UtilButtons.qml +++ b/.config/quickshell/ii/modules/bar/UtilButtons.qml @@ -130,7 +130,7 @@ Item { fill: 0 text: switch(PowerProfiles.profile) { case PowerProfile.PowerSaver: return "battery_saver" - case PowerProfile.Balanced: return "balance" + case PowerProfile.Balanced: return "dynamic_form" case PowerProfile.Performance: return "speed" } iconSize: Appearance.font.pixelSize.large