feat(nix-monitor): add panel card background customization

This commit is contained in:
avivbintangaringga
2026-07-16 10:48:34 +07:00
parent 8ac264789c
commit 43b4db599f
3 changed files with 52 additions and 30 deletions
+10 -4
View File
@@ -20,9 +20,15 @@ function watchState(key, cb)
noctalia.state.watch(key, cb) noctalia.state.watch(key, cb)
end end
local function getBackgroundColor()
local color = cfg("panel_card_color")
local opacity = cfg("panel_card_opacity") / 100
return `{color}/{opacity}`
end
local function labelBox(subtext, text, glyph) local function labelBox(subtext, text, glyph)
return ui.column({ return ui.column({
fill = "surface/0.7", fill = getBackgroundColor(),
flexGrow = 1, flexGrow = 1,
height = 100, height = 100,
radius = 8, radius = 8,
@@ -51,7 +57,7 @@ local function statLabel(text, glyph: string?)
if glyph ~= nil then if glyph ~= nil then
table.insert(items, ui.glyph({ table.insert(items, ui.glyph({
name = glyph, name = glyph,
size = 20 size = 18
})) }))
end end
@@ -151,7 +157,7 @@ local function render()
spacing = 4 spacing = 4
}), }),
ui.row({ ui.row({
fill = "surface/0.7", fill = getBackgroundColor(),
align = "center", align = "center",
justify = "space_between", justify = "space_between",
flexGrow = 1, flexGrow = 1,
@@ -160,7 +166,7 @@ local function render()
radius = 8, radius = 8,
}, generationItems), }, generationItems),
ui.row({ ui.row({
fill = "surface/0.7", fill = getBackgroundColor(),
align = "center", align = "center",
justify = "center", justify = "center",
flexGrow = 1, flexGrow = 1,
+40 -26
View File
@@ -85,6 +85,32 @@ type = "color"
label_key = "setting.widget.unknown_color.label" label_key = "setting.widget.unknown_color.label"
default = "on_surface" default = "on_surface"
[[setting]]
key = "branch"
type = "select"
label_key = "setting.branch.label"
description_key = "setting.branch.description"
options = [
{ value = "master", label_key = "setting.option.branch.master" },
{ value = "nixos-unstable", label_key = "setting.option.branch.nixos_unstable" },
{ value = "nixos-unstable-small", label_key = "setting.option.branch.nixos_unstable_small" },
{ value = "nixos-26.05", label_key = "setting.option.branch.nixos_26_05" },
{ value = "nixos-25.11", label_key = "setting.option.branch.nixos_25_11" },
{ value = "nixos-25.05", label_key = "setting.option.branch.nixos_25_05" },
{ value = "nixos-24.11", label_key = "setting.option.branch.nixos_24_11" },
{ value = "nixos-24.05", label_key = "setting.option.branch.nixos_24_05" },
{ value = "nixos-23.11", label_key = "setting.option.branch.nixos_23_11" },
{ value = "nixos-23.05", label_key = "setting.option.branch.nixos_23_05" },
{ value = "nixos-26.05-small", label_key = "setting.option.branch.nixos_26_05_small" },
{ value = "nixos-25.11-small", label_key = "setting.option.branch.nixos_25_11_small" },
{ value = "nixos-25.05-small", label_key = "setting.option.branch.nixos_25_05_small" },
{ value = "nixos-24.11-small", label_key = "setting.option.branch.nixos_24_11_small" },
{ value = "nixos-24.05-small", label_key = "setting.option.branch.nixos_24_05_small" },
{ value = "nixos-23.11-small", label_key = "setting.option.branch.nixos_23_11_small" },
{ value = "nixos-23.05-small", label_key = "setting.option.branch.nixos_23_05_small" },
]
default = "nixos-unstable"
[[setting]] [[setting]]
key = "update_check_interval" key = "update_check_interval"
type = "int" type = "int"
@@ -119,6 +145,20 @@ default = 5
min = 1 min = 1
max = 30 max = 30
[[setting]]
key = "panel_card_color"
type = "color"
label_key = "setting.widget.panel_card_background_color.label"
default = "surface_variant"
[[setting]]
key = "panel_card_opacity"
type = "int"
label_key = "setting.widget.panel_card_background_opacity.label"
default = 70
min = 0
max = 100
[[setting]] [[setting]]
key = "show_update_check_notification" key = "show_update_check_notification"
type = "bool" type = "bool"
@@ -133,32 +173,6 @@ label_key = "setting.show_update_available_notification.label"
description_key = "setting.show_update_available_notification.description" description_key = "setting.show_update_available_notification.description"
default = true default = true
[[setting]]
key = "branch"
type = "select"
label_key = "setting.branch.label"
description_key = "setting.branch.description"
options = [
{ value = "master", label_key = "setting.option.branch.master" },
{ value = "nixos-unstable", label_key = "setting.option.branch.nixos_unstable" },
{ value = "nixos-unstable-small", label_key = "setting.option.branch.nixos_unstable_small" },
{ value = "nixos-26.05", label_key = "setting.option.branch.nixos_26_05" },
{ value = "nixos-25.11", label_key = "setting.option.branch.nixos_25_11" },
{ value = "nixos-25.05", label_key = "setting.option.branch.nixos_25_05" },
{ value = "nixos-24.11", label_key = "setting.option.branch.nixos_24_11" },
{ value = "nixos-24.05", label_key = "setting.option.branch.nixos_24_05" },
{ value = "nixos-23.11", label_key = "setting.option.branch.nixos_23_11" },
{ value = "nixos-23.05", label_key = "setting.option.branch.nixos_23_05" },
{ value = "nixos-26.05-small", label_key = "setting.option.branch.nixos_26_05_small" },
{ value = "nixos-25.11-small", label_key = "setting.option.branch.nixos_25_11_small" },
{ value = "nixos-25.05-small", label_key = "setting.option.branch.nixos_25_05_small" },
{ value = "nixos-24.11-small", label_key = "setting.option.branch.nixos_24_11_small" },
{ value = "nixos-24.05-small", label_key = "setting.option.branch.nixos_24_05_small" },
{ value = "nixos-23.11-small", label_key = "setting.option.branch.nixos_23_11_small" },
{ value = "nixos-23.05-small", label_key = "setting.option.branch.nixos_23_05_small" },
]
default = "nixos-unstable"
[[setting]] [[setting]]
key = "update_command" key = "update_command"
type = "string" type = "string"
+2
View File
@@ -32,6 +32,8 @@
"setting.widget.update_available_color.label": "Update available color", "setting.widget.update_available_color.label": "Update available color",
"setting.widget.unknown_glyph.label": "Unknown status glyph", "setting.widget.unknown_glyph.label": "Unknown status glyph",
"setting.widget.unknown_color.label": "Unknown status color", "setting.widget.unknown_color.label": "Unknown status color",
"setting.widget.panel_card_background_color.label": "Panel card background color",
"setting.widget.panel_card_background_opacity.label": "Panel card background opacity",
"setting.update_check_interval.label": "Update check interval", "setting.update_check_interval.label": "Update check interval",
"setting.update_check_interval.description": "How often to check for updates (in minutes)", "setting.update_check_interval.description": "How often to check for updates (in minutes)",
"setting.update_check_duration_threshold.label": "Update check duration threshold", "setting.update_check_duration_threshold.label": "Update check duration threshold",