Feat: Peripheral status and integration #140

Merged
zach merged 17 commits from feat/peripheral-integration into main 2026-08-16 18:03:42 +02:00
2 changed files with 6 additions and 2 deletions
Showing only changes of commit 85320e9ea1 - Show all commits
+1 -1
View File
@@ -21,7 +21,7 @@ Singleton {
readonly property bool ready: UPower.displayDevice.ready
readonly property real timeToEmpty: UPower.displayDevice.timeToEmpty
readonly property real timeToFull: UPower.displayDevice.timeToFull
readonly property list<UPowerDevice> upowerDevices: UPower.devices.values
readonly property list<UPowerDevice> upowerDevices: UPower.devices.values.filter(d => d.state !== UPowerDeviceState.Unknown)
function getColors(percentage: real, state: string): var {
if (state === "charging" || state === "full" || state === "recharging")
+5 -1
View File
@@ -229,11 +229,15 @@ def daemon(
typer.echo(f"Polling every {interval}s, writing to {out}")
last_payload = None
try:
while running:
try:
results = poll_once()
_write_json_atomic(out, results)
payload = [asdict(r) for r in results]
if payload != last_payload:
_write_json_atomic(out, results)
last_payload = payload
except RuntimeError as e:
typer.echo(f"error: {e}", err=True)
raise typer.Exit(code=1) from None
2