docs: sync widget.luau in plan with review fixes

This commit is contained in:
loki committed 2026-08-31 12:32:21 +02:00
1 parent 96bf267937
commit 55329ec190
1 file changed
+11 -2
@@ -610,7 +610,7 @@ local function batteryGlyph()
end
local function batteryColor()
local low = noctalia.getConfig("battery_low")
local low = noctalia.getConfig("battery_low") or 20
if battery.level < 0 then return "#6e7681" end
if battery.level <= low then return "#e5484d" end
if battery.status == "BATTERY_CHARGING" then return "#3fb950" end
@@ -618,6 +618,7 @@ local function batteryColor()
end
local function render()
if not barWidget then return end
if errorState == "no_binary" then
barWidget.setGlyph("alert-triangle")
barWidget.setColor("#e5484d")
@@ -661,8 +662,14 @@ end
local function sendSidetone(value)
value = math.clamp(value, 0, 128)
local previous = sidetoneValue
hsc.sendCommand({ "-s", tostring(value) }, function(res)
if res.exitCode ~= 0 then
if previous ~= nil then
sidetoneValue = previous
end
sidetoneFlashUntil = 0
render()
noctalia.notifyError(noctalia.tr("error.command_failed"), string.sub(res.stderr or "", 1, 200))
return
end
@@ -675,7 +682,8 @@ end
function onScroll(axis, steps)
if axis ~= "vertical" then return end
local current = sidetoneValue or noctalia.getConfig("sidetone_default")
if not caps.sidetone or errorState ~= "" then return end
local current = sidetoneValue or noctalia.getConfig("sidetone_default") or 64
sendSidetone(current + steps * 4)
end
@@ -711,6 +719,7 @@ noctalia.state.watch("error", function(v) errorState = v or ""; render() end)
noctalia.state.watch("sidetone", function(v) if v ~= nil then sidetoneValue = v end end)
syncState()
render()
```
- [ ] **Step 2: Verify the widget loads (hot-reload)**