fix(nix-monitor): change barWidget.getConfig to noctalia.getConfig

This commit is contained in:
avivbintangaringga
2026-07-15 11:52:07 +07:00
parent 70c2ec286d
commit ed42fc9be1
2 changed files with 10 additions and 15 deletions
+10 -11
View File
@@ -1,10 +1,9 @@
function tr(key) function tr(key)
return noctalia.tr(key) return noctalia.tr(key)
end end
function barCfg(key) function cfg(key)
return barWidget.getConfig(key) return noctalia.getConfig(key)
end end
function getState(key) function getState(key)
@@ -16,19 +15,19 @@ function displayWidget(glyph: string, text: string, color: string?)
color = "on_surface" color = "on_surface"
end end
if barCfg("colorize_text") then if cfg("colorize_text") then
barWidget.setColor(color) barWidget.setColor(color)
end end
if barCfg("colorize_glyph") then if cfg("colorize_glyph") then
barWidget.setGlyphColor(color) barWidget.setGlyphColor(color)
end end
if barCfg("show_glyph") then if cfg("show_glyph") then
barWidget.setGlyph(glyph) barWidget.setGlyph(glyph)
end end
if barCfg("show_text") then if cfg("show_text") then
barWidget.setText(text) barWidget.setText(text)
end end
end end
@@ -36,15 +35,15 @@ end
-- Hooks -- Hooks
function update() function update()
if getState("isRemoteCheckRunning") then if getState("isRemoteCheckRunning") then
displayWidget(barCfg("checking_glyph"), tr("bar.checking"), barCfg("checking_color")) displayWidget(cfg("checking_glyph"), tr("bar.checking"), cfg("checking_color"))
else else
if getState("isUpdateAvailable") then if getState("isUpdateAvailable") then
displayWidget(barCfg("update_available_glyph"), tr("bar.update_available"), barCfg("update_available_color")) displayWidget(cfg("update_available_glyph"), tr("bar.update_available"), cfg("update_available_color"))
else else
if getState("localHash") == "n/a" or getState("remoteHash") == "n/a" then if getState("localHash") == "n/a" or getState("remoteHash") == "n/a" then
displayWidget(barCfg("unknown_glyph"), tr("bar.unknown"), barCfg("unknown_color")) displayWidget(cfg("unknown_glyph"), tr("bar.unknown"), cfg("unknown_color"))
else else
displayWidget(barCfg("up_to_date_glyph"), tr("bar.up_to_date"), barCfg("up_to_date_color")) displayWidget(cfg("up_to_date_glyph"), tr("bar.up_to_date"), cfg("up_to_date_color"))
end end
end end
end end
-4
View File
@@ -4,10 +4,6 @@ function tr(key)
return noctalia.tr(key) return noctalia.tr(key)
end end
function barCfg(key)
return barWidget.getConfig(key)
end
function cfg(key) function cfg(key)
return noctalia.getConfig(key) return noctalia.getConfig(key)
end end