feat(noctalia): add portable status widgets and idle monitoring

This commit is contained in:
2026-08-03 16:57:19 +02:00
parent ba9c351589
commit 67004150dc
12 changed files with 694 additions and 2 deletions
@@ -0,0 +1,31 @@
-- Query EnvyControl once when this widget starts; GPU mode changes require a restart.
local command = "envycontrol --query"
local labels = {
integrated = "iGPU",
dedicated = "dGPU",
nvidia = "dGPU",
hybrid = "hybrid",
}
barWidget.setGlyph("device-desktop")
barWidget.setText("GPU…")
barWidget.setTooltip("Reading EnvyControl GPU mode…")
noctalia.runAsync(command, function(result)
if result.exitCode ~= 0 then
barWidget.setText("GPU?")
barWidget.setTooltip("Unable to read EnvyControl GPU mode")
return
end
local mode = string.lower(string.match(result.stdout, "([%a_-]+)") or "")
local label = labels[mode]
if label == nil then
barWidget.setText("GPU?")
barWidget.setTooltip("Unknown EnvyControl GPU mode: " .. mode)
return
end
barWidget.setText(label)
barWidget.setTooltip("EnvyControl GPU mode: " .. mode)
end)