Feat: Peripheral status and integration #140
+1
-1
@@ -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")
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user