Improve panes system and add battery pane

This commit is contained in:
2026-02-26 02:50:28 -08:00
parent 86cf291663
commit a3ffbc80c5
41 changed files with 528 additions and 273 deletions

60
Widgets/Battery.qml Normal file
View File

@@ -0,0 +1,60 @@
import Quickshell.Services.UPower
import Quickshell.Widgets
import QtQuick
import Quickshell
import "." as Widgets
Item {
anchors {
top: parent.top
bottom: parent.bottom
}
width: children[1].width + 20
Rectangle {
anchors.fill: parent
anchors.margins: 4
color: hover.hovered ? "#11ffffff" : "#00ffffff"
radius: 8
bottomLeftRadius: 12
}
Row {
anchors {
verticalCenter: parent.verticalCenter
}
x: 8
spacing: 4
Image {
anchors.verticalCenter: parent.verticalCenter
width: 20
height: width
sourceSize { width: width; height: height }
source: {
if (UPower.displayDevice.state === UPowerDeviceState.Charging)
return Quickshell.shellPath("assets/battery-charging-symbolic.svg")
switch (PowerProfiles.profile) {
case PowerProfile.PowerSaver:
return Quickshell.shellPath("assets/power-saver-symbolic.svg")
break;
case PowerProfile.Balanced:
return Quickshell.shellPath("assets/balanced-symbolic.svg")
break;
case PowerProfile.Performance:
return Quickshell.shellPath("assets/performance-symbolic.svg")
break;
}
return Quickshell.shellPath("assets/battery-performance-symbolic.svg")
}
}
Text {
id: content
anchors.verticalCenter: parent.verticalCenter
x: 10
color: "white"
text: `${Math.round(UPower.displayDevice.percentage * 100)}% · ${Math.round(UPower.displayDevice.changeRate)}W`
}
}
HoverHandler {id: hover}
TapHandler {onTapped: {
background.index = 2
}}
}