add charging indicator for statusIcons

This commit is contained in:
lucy 2026-01-16 15:15:44 +01:00
parent 051c1815b3
commit 32a385bfb7
9 changed files with 49 additions and 30 deletions

15
:w Normal file
View File

@ -0,0 +1,15 @@
import QtQuick
import "../settings/"
import "../"
Text {
property real fill
font.family: "Material Symbols Rounded"
color: Colors.foreground
font.pixelSize: Settings.config.fontSize + 2
font.variableAxes: {
wght: 700,
}
}

View File

@ -28,9 +28,7 @@ Variants {
property var screen: root.modelData property var screen: root.modelData
Layout.leftMargin: 10 Layout.leftMargin: 10
} }
Title { Title {}
anchors.verticalCenter: parent.verticalCenter
}
} }
Row { Row {
@ -47,7 +45,7 @@ Variants {
Volume {} Volume {}
Battery {} Battery {}
SystemTray { SystemTray {
Layout.rightMargin: 10 Layout.rightMargin: 10
} }
} }
} }

View File

@ -19,11 +19,10 @@ Loader {
property bool frame4: UPower.displayDevice.percentage < 0.74 property bool frame4: UPower.displayDevice.percentage < 0.74
property bool frame5: UPower.displayDevice.percentage < 0.90 property bool frame5: UPower.displayDevice.percentage < 0.90
property bool frame6: UPower.displayDevice.percentage <= 1 property bool frame6: UPower.displayDevice.percentage <= 1
property bool charging: UPower.displayDevice.Charging
function getBatteryIcon() { function getBatteryIcon() {
if (charging) { if (UPower.displayDevice.state == UPowerDeviceState.Charging) {
return "battery_android_frame_bolt" return "battery_android_frame_bolt";
} }
if (frame1) { if (frame1) {
return "battery_android_frame_1"; return "battery_android_frame_1";
@ -48,19 +47,18 @@ Loader {
implicitWidth: batRow.implicitWidth implicitWidth: batRow.implicitWidth
implicitHeight: Settings.config.barHeight implicitHeight: Settings.config.barHeight
Row { Row {
anchors.centerIn: parent id: batRow
id: batRow anchors.verticalCenter: parent.verticalCenter
spacing: 5 spacing: 5
CustomText { CustomText {
id: batText id: batText
text: Math.round(UPower.displayDevice.percentage * 100) + "%" text: Math.round(UPower.displayDevice.percentage * 100) + "%"
} }
CustomIcon { CustomIcon {
id: batIcon id: batIcon
text: root.getBatteryIcon() text: root.getBatteryIcon()
}
} }
} }
}
} }

View File

@ -7,7 +7,6 @@ Item {
id: root id: root
implicitWidth: trayRow.implicitWidth implicitWidth: trayRow.implicitWidth
implicitHeight: Settings.config.barHeight implicitHeight: Settings.config.barHeight
anchors.verticalCenter: parent.verticalCenter
Row { Row {
id: trayRow id: trayRow

View File

@ -33,19 +33,21 @@ Item {
implicitWidth: textRow.implicitWidth + 10 implicitWidth: textRow.implicitWidth + 10
implicitHeight: Settings.config.barHeight implicitHeight: Settings.config.barHeight
Row { Row {
id: textRow
anchors.centerIn: parent anchors.centerIn: parent
spacing: 5 spacing: 5
id: textRow
CustomText { CustomText {
id: volumeText id: volumeText
PwObjectTracker { PwObjectTracker {
objects: Pipewire.ready ? Pipewire.defaultAudioSink : [] objects: Pipewire.ready ? Pipewire.defaultAudioSink : []
} }
text: Pipewire.ready ? Math.round(root.sink.audio.volume * 100) + "%" : "failure" text: Pipewire.ready ? Math.round(root.sink.audio.volume * 100) + "%" : "failure"
opacity: root.sink.audio.muted ? 0.5 : 1
} }
CustomIcon { CustomIcon {
id: volumeIcon id: volumeIcon
text: root.getVolumeIcon() opacity: root.sink.audio.muted ? 0.5 : 1
text: root.getVolumeIcon()
} }
} }
} }

View File

@ -7,5 +7,9 @@ Text {
font.family: "Material Symbols Rounded" font.family: "Material Symbols Rounded"
color: Colors.foreground color: Colors.foreground
font.pixelSize: Settings.config.fontSize + 2 font.pixelSize: Settings.config.fontSize + 2
font.weight: 500 font.variableAxes: ({
FILL: fill.toFixed(1),
GRAD: 200,
wght: 400
})
} }

View File

@ -3,8 +3,11 @@ import "../settings/"
import "../" import "../"
Text { Text {
font.weight: 900
color: Colors.foreground color: Colors.foreground
font.family: Settings.config.font font.family: Settings.config.font
font.pixelSize: Settings.config.fontSize font.pixelSize: Settings.config.fontSize
font.variableAxes: ({
GRAD: 200,
wght: 400
})
} }

View File

@ -23,8 +23,8 @@ Singleton {
id: settingsAdapter id: settingsAdapter
property var currentWall: "/home/lucy/.walls/faris.jpg" property var currentWall: "/home/lucy/.walls/faris.jpg"
property var barHeight: 28 property var barHeight: 28
property var font: "JetBrainsMono Nerd Font" property var font: "SauceCodePro Nerd Font Mono"
property var fontSize: 12 property var fontSize: 14
property var rounding: 10 property var rounding: 10
property var wallDir: "/home/lucy/.walls" property var wallDir: "/home/lucy/.walls"
property bool floating: true property bool floating: true

View File

@ -2,8 +2,8 @@
"barHeight": 28, "barHeight": 28,
"currentWall": "/home/lucy/.walls/faris.jpg", "currentWall": "/home/lucy/.walls/faris.jpg",
"floating": true, "floating": true,
"font": "JetBrainsMono Nerd Font", "font": "SauceCodePro Nerd Font Mono",
"fontSize": 12, "fontSize": 14,
"paddingSides": 10, "paddingSides": 10,
"paddingTop": 10, "paddingTop": 10,
"rounding": 10, "rounding": 10,