forked from Shinonome/dots-hyprland
feat: power-profile switcher in topbar
This commit is contained in:
@@ -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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -123,6 +123,7 @@ Singleton {
|
|||||||
property bool showMicToggle: false
|
property bool showMicToggle: false
|
||||||
property bool showKeyboardToggle: true
|
property bool showKeyboardToggle: true
|
||||||
property bool showDarkModeToggle: true
|
property bool showDarkModeToggle: true
|
||||||
|
property bool showPerfProfileToggle: false
|
||||||
}
|
}
|
||||||
property JsonObject tray: JsonObject {
|
property JsonObject tray: JsonObject {
|
||||||
property bool monochromeIcons: true
|
property bool monochromeIcons: true
|
||||||
|
|||||||
@@ -164,8 +164,11 @@ ContentPage {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
ConfigSwitch {
|
ConfigSwitch {
|
||||||
opacity: 0
|
text: "Performance Profile toggle"
|
||||||
enabled: false
|
checked: Config.options.bar.utilButtons.showPerfProfileToggle
|
||||||
|
onCheckedChanged: {
|
||||||
|
Config.options.bar.utilButtons.showPerfProfileToggle = checked;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user