added voltage in battery menu

This commit is contained in:
wt committed 2025-03-20 11:32:46 +07:00
1 parent cf7bf010f9
commit 0b5bd9cc9f
2 files changed
+55 -20

No files matched your search

+4 -3
View File
@@ -1,7 +1,7 @@
import { Astal, App, Gtk } from "astal/gtk3";
import Battery from "gi://AstalBattery";
import { bind, Variable } from "astal";
import {cycles_count, health} from "./helpers.ts";
import { cycles_count, health, voltage } from "./helpers.ts";
const BatteryMenu = () => {
const { TOP, RIGHT } = Astal.WindowAnchor;
@@ -9,7 +9,8 @@ const BatteryMenu = () => {
const bat = Battery.get_default();
const batcycles = Variable<string>("").poll(5000, () => cycles_count());
const bathealth = Variable<string>("").poll(5000, () => health());
const batvoltage = Variable<string>("").poll(5000, () => voltage());
return (
<window
anchor={TOP | RIGHT}
@@ -80,7 +81,7 @@ const BatteryMenu = () => {
halign={START}
label="Voltage:"
/>
<label hexpand halign={END} label="12.1 V" />
<label hexpand halign={END} label={batvoltage()} />
</box>
</box>
</box>