BluetoothPanel: dynamic battery icons for devices

This commit is contained in:
Turann_
2026-01-12 03:11:28 +03:00
parent 62798d5c57
commit bc21ab5191
@@ -5,6 +5,7 @@ import Quickshell
import Quickshell.Bluetooth
import Quickshell.Wayland
import qs.Commons
import qs.Services.Hardware
import qs.Services.Networking
import qs.Services.UI
import qs.Widgets
@@ -161,7 +162,10 @@ NBox {
spacing: Style.marginXS
NIcon {
icon: "battery"
icon: {
var b = BluetoothService.getBatteryPercent(modelData);
return BatteryService.getIcon(b !== null ? b : 0, false, b !== null);
}
pointSize: Style.fontSizeXS
color: getContentColor(Color.mOnSurface)
}
@@ -341,7 +345,10 @@ NBox {
Layout.preferredWidth: 1
spacing: Style.marginXS
NIcon {
icon: "battery"
icon: {
var b = BluetoothService.getBatteryPercent(modelData);
return BatteryService.getIcon(b !== null ? b : 0, false, b !== null);
}
pointSize: Style.fontSizeXS
color: Color.mOnSurface
MouseArea {