[AGS] Improve Battery display

This commit is contained in:
Admin 2025-05-08 12:53:53 +02:00
parent a005189aef
commit c3ff5a58d6
2 changed files with 4 additions and 2 deletions

View File

@ -29,11 +29,13 @@ export const BatteryBox = () => {
cssClasses={["battery-time"]}
visible={bind(battery, "charging").as(c => !c)}
label={bind(battery, "timeToEmpty").as(t => `(${toTime(t)})`)}
tooltipText={bind(battery, 'energyRate').as(er => `Time to empty. Power usage: ${batteryEnergy(er)}`)}
/>
<label
cssClasses={["battery-time"]}
visible={bind(battery, "charging")}
label={bind(battery, "timeToFull").as(t => `(${toTime(t)})`)}
tooltipText={bind(battery, 'energyRate').as(er => `Time to full. Charge rate: ${batteryEnergy(er)}`)}
/>
</box>
);
@ -43,7 +45,7 @@ const toTime = (time: number) => {
const MINUTE = 60;
const HOUR = MINUTE * 60;
if (time > 24 * HOUR) return "";
if (time > 24 * HOUR) return "24h+";
const hours = Math.round(time / HOUR);
const minutes = Math.round((time - hours * HOUR) / MINUTE);

View File

@ -127,7 +127,7 @@ const BatteryWidget = () => {
<image
iconName={bind(battery, "batteryIconName").as(icon => icon)}
cssClasses={["quick-view-symbol"]}
tooltipText={bind(battery, 'percentage').as(p => `${Math.round(p * 100)}%`)}
tooltipText={bind(battery, 'percentage').as(p => `Battery Level: ${Math.round(p * 100)}%`)}
></image>
);
} else {