nova-shell/modules/PowerProfile.qml

29 lines
970 B
QML

import QtQuick
import "." as M
M.BarIcon {
id: root
tooltip: "Power profile: " + (M.PowerProfileService.profile || "unknown")
color: M.PowerProfileService.profile === "performance" ? M.Theme.base09 : M.PowerProfileService.profile === "power-saver" ? M.Theme.base0B : parent?.accentColor ?? M.Theme.base05
icon: {
if (M.PowerProfileService.profile === "performance")
return "\uF0E7";
if (M.PowerProfileService.profile === "power-saver")
return "\uF06C";
if (M.PowerProfileService.profile === "balanced")
return "\uF24E";
return "\uF0E7";
}
MouseArea {
anchors.fill: parent
cursorShape: Qt.PointingHandCursor
onClicked: {
const cycle = ["performance", "balanced", "power-saver"];
const idx = cycle.indexOf(M.PowerProfileService.profile);
M.PowerProfileService.set(cycle[(idx + 1) % cycle.length]);
}
}
}