dedup, monospace font for icons

This commit is contained in:
Damocles 2026-04-11 00:35:37 +02:00
parent cd45c2d9cf
commit 00838e1d64
18 changed files with 67 additions and 80 deletions

View file

@ -11,23 +11,19 @@ Row {
readonly property real pct: (dev?.percentage ?? 0) * 100
readonly property bool charging: dev?.state === UPowerDeviceState.Charging
Text {
text: {
if (root.charging)
return "";
M.BarIcon {
icon: {
if (root.charging) return "";
const icons = ["󰂎", "󰁺", "󰁻", "󰁼", "󰁽", "󰁾", "󰁿", "󰂀", "󰂁", "󰂂", "󱟢"];
return icons[Math.min(10, Math.floor(root.pct / 10))];
}
color: root.pct < 15 ? M.Theme.base08 : M.Theme.base05
font.pixelSize: M.Theme.fontSize + 2
font.family: M.Theme.fontFamily
anchors.verticalCenter: parent.verticalCenter
}
Text {
text: Math.round(root.pct) + "%"
M.BarLabel {
label: Math.round(root.pct) + "%"
color: root.pct < 15 ? M.Theme.base08 : M.Theme.base05
font.pixelSize: M.Theme.fontSize
font.family: M.Theme.fontFamily
anchors.verticalCenter: parent.verticalCenter
}
}