forked from Shinonome/dots-hyprland
Don't display when unsupported
This commit is contained in:
@@ -86,7 +86,7 @@ StyledPopup {
|
|||||||
|
|
||||||
RowLayout {
|
RowLayout {
|
||||||
spacing: 5
|
spacing: 5
|
||||||
visible: Config.options.battery.showHealth
|
visible: Config.options.battery.showHealth && Battery.health > 0
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
|
||||||
MaterialSymbol {
|
MaterialSymbol {
|
||||||
|
|||||||
@@ -35,14 +35,13 @@ Singleton {
|
|||||||
if (!Config.options.battery.showHealth) {
|
if (!Config.options.battery.showHealth) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
const devList = UPower.devices.values;
|
const devList = UPower.devices.values;
|
||||||
for (let i = 0; i < devList.length; ++i) {
|
for (let i = 0; i < devList.length; ++i) {
|
||||||
const dev = devList[i];
|
const dev = devList[i];
|
||||||
if (dev.isLaptopBattery && dev.healthSupported) {
|
if (dev.isLaptopBattery && dev.healthSupported) {
|
||||||
const health = dev.healthPercentage;
|
const health = dev.healthPercentage;
|
||||||
if (health === 0) {
|
if (health === 0) {
|
||||||
return 0;
|
return 0.01;
|
||||||
} else if (health < 1) {
|
} else if (health < 1) {
|
||||||
return health * 100;
|
return health * 100;
|
||||||
} else {
|
} else {
|
||||||
@@ -54,7 +53,6 @@ Singleton {
|
|||||||
})()
|
})()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
onIsLowAndNotChargingChanged: {
|
onIsLowAndNotChargingChanged: {
|
||||||
if (!root.available || !isLowAndNotCharging) return;
|
if (!root.available || !isLowAndNotCharging) return;
|
||||||
Quickshell.execDetached([
|
Quickshell.execDetached([
|
||||||
|
|||||||
Reference in New Issue
Block a user