[AGS] Improve Battery display
This commit is contained in:
parent
a005189aef
commit
c3ff5a58d6
@ -29,11 +29,13 @@ export const BatteryBox = () => {
|
|||||||
cssClasses={["battery-time"]}
|
cssClasses={["battery-time"]}
|
||||||
visible={bind(battery, "charging").as(c => !c)}
|
visible={bind(battery, "charging").as(c => !c)}
|
||||||
label={bind(battery, "timeToEmpty").as(t => `(${toTime(t)})`)}
|
label={bind(battery, "timeToEmpty").as(t => `(${toTime(t)})`)}
|
||||||
|
tooltipText={bind(battery, 'energyRate').as(er => `Time to empty. Power usage: ${batteryEnergy(er)}`)}
|
||||||
/>
|
/>
|
||||||
<label
|
<label
|
||||||
cssClasses={["battery-time"]}
|
cssClasses={["battery-time"]}
|
||||||
visible={bind(battery, "charging")}
|
visible={bind(battery, "charging")}
|
||||||
label={bind(battery, "timeToFull").as(t => `(${toTime(t)})`)}
|
label={bind(battery, "timeToFull").as(t => `(${toTime(t)})`)}
|
||||||
|
tooltipText={bind(battery, 'energyRate').as(er => `Time to full. Charge rate: ${batteryEnergy(er)}`)}
|
||||||
/>
|
/>
|
||||||
</box>
|
</box>
|
||||||
);
|
);
|
||||||
@ -43,7 +45,7 @@ const toTime = (time: number) => {
|
|||||||
const MINUTE = 60;
|
const MINUTE = 60;
|
||||||
const HOUR = MINUTE * 60;
|
const HOUR = MINUTE * 60;
|
||||||
|
|
||||||
if (time > 24 * HOUR) return "";
|
if (time > 24 * HOUR) return "24h+";
|
||||||
|
|
||||||
const hours = Math.round(time / HOUR);
|
const hours = Math.round(time / HOUR);
|
||||||
const minutes = Math.round((time - hours * HOUR) / MINUTE);
|
const minutes = Math.round((time - hours * HOUR) / MINUTE);
|
||||||
|
@ -127,7 +127,7 @@ const BatteryWidget = () => {
|
|||||||
<image
|
<image
|
||||||
iconName={bind(battery, "batteryIconName").as(icon => icon)}
|
iconName={bind(battery, "batteryIconName").as(icon => icon)}
|
||||||
cssClasses={["quick-view-symbol"]}
|
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>
|
></image>
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user