diff --git a/.config/quickshell/ii/modules/bar/UtilButtons.qml b/.config/quickshell/ii/modules/bar/UtilButtons.qml index dcda858d..55cad80e 100644 --- a/.config/quickshell/ii/modules/bar/UtilButtons.qml +++ b/.config/quickshell/ii/modules/bar/UtilButtons.qml @@ -5,6 +5,7 @@ import QtQuick.Layouts import Quickshell import Quickshell.Hyprland import Quickshell.Services.Pipewire +import Quickshell.Services.UPower Item { id: root @@ -103,5 +104,38 @@ Item { } } } + + Loader { + active: Config.options.bar.utilButtons.showPerformanceProfileToggle + visible: Config.options.bar.utilButtons.showPerformanceProfileToggle + 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 "dynamic_form" + 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 7462d26e..cd6231cc 100644 --- a/.config/quickshell/ii/modules/common/Config.qml +++ b/.config/quickshell/ii/modules/common/Config.qml @@ -125,6 +125,7 @@ Singleton { property bool showMicToggle: false property bool showKeyboardToggle: true property bool showDarkModeToggle: true + 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 32633996..b6ed0811 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.showPerformanceProfileToggle + onCheckedChanged: { + Config.options.bar.utilButtons.showPerformanceProfileToggle = checked; + } } } }