vendor icons and use phosphor icons
This commit is contained in:
parent
3e29ca8cc3
commit
4a635354c9
3033 changed files with 3068 additions and 42 deletions
|
|
@ -16,19 +16,26 @@ BarComponent {
|
|||
property bool charging: UPower.displayDevice.state === UPowerDeviceState.Charging
|
||||
implicitWidth: batLayout.implicitWidth + 16
|
||||
|
||||
function batteryIcon(): string {
|
||||
const p = root.percent;
|
||||
function batteryIcon(): string {
|
||||
const level = root.percent;
|
||||
const chg = root.charging;
|
||||
const isFull = root.full;
|
||||
|
||||
if (isFull)
|
||||
return "battery-level-100-charged-symbolic";
|
||||
|
||||
if (p < 10)
|
||||
return chg ? "battery-empty-charging-symbolic" : "battery-empty-symbolic";
|
||||
|
||||
const level = Math.min(100, Math.floor(p / 10) * 10);
|
||||
return chg ? `battery-level-${level}-charging-symbolic` : `battery-level-${level}-symbolic`;
|
||||
if (chg) {
|
||||
return "battery-charging";
|
||||
}
|
||||
if (level <= 25) {
|
||||
return "battery-warning";
|
||||
}
|
||||
if (level <= 50) {
|
||||
return "battery-medium";
|
||||
}
|
||||
if (level <= 75) {
|
||||
return "battery-high";
|
||||
}
|
||||
if (level > 75) {
|
||||
return "battery-full";
|
||||
}
|
||||
}
|
||||
RowLayout {
|
||||
id: batLayout
|
||||
|
|
|
|||
Loading…
Reference in a new issue