weather options

This commit is contained in:
Damocles 2026-04-12 15:20:38 +02:00
parent d6d108ee7c
commit 3a6ba994c5
3 changed files with 18 additions and 2 deletions

View file

@ -27,6 +27,8 @@ QtObject {
property bool battery: true property bool battery: true
property bool wlogout: true property bool wlogout: true
property var weatherArgs: ["--nerd"]
property FileView _file: FileView { property FileView _file: FileView {
path: (Quickshell.env("XDG_CONFIG_HOME") || (Quickshell.env("HOME") + "/.config")) + "/nova-shell/modules.json" path: (Quickshell.env("XDG_CONFIG_HOME") || (Quickshell.env("HOME") + "/.config")) + "/nova-shell/modules.json"
watchChanges: true watchChanges: true
@ -45,5 +47,7 @@ QtObject {
if (k in root && typeof root[k] === "boolean") if (k in root && typeof root[k] === "boolean")
root[k] = data[k]; root[k] = data[k];
} }
if (Array.isArray(data.weatherArgs))
root.weatherArgs = data.weatherArgs;
} }
} }

View file

@ -12,7 +12,7 @@ M.BarSection {
Process { Process {
id: proc id: proc
running: true running: true
command: ["wttrbar", "--nerd"] command: ["wttrbar"].concat(M.Modules.weatherArgs)
stdout: StdioCollector { stdout: StdioCollector {
onStreamFinished: { onStreamFinished: {
try { try {

View file

@ -86,6 +86,17 @@ in
}; };
}; };
weatherArgs = lib.mkOption {
type = lib.types.listOf lib.types.str;
default = [ "--nerd" ];
description = "Arguments passed to wttrbar.";
example = [
"--nerd"
"--location"
"Berlin"
];
};
theme = lib.mkOption { theme = lib.mkOption {
type = lib.types.attrsOf lib.types.anything; type = lib.types.attrsOf lib.types.anything;
default = { }; default = { };
@ -120,7 +131,8 @@ in
++ lib.optional cfg.modules.weather pkgs.wttrbar; ++ lib.optional cfg.modules.weather pkgs.wttrbar;
xdg.configFile."nova-shell/modules.json".source = xdg.configFile."nova-shell/modules.json".source =
(pkgs.formats.json { }).generate "nova-shell-modules.json" cfg.modules; (pkgs.formats.json { }).generate "nova-shell-modules.json"
(cfg.modules // { weatherArgs = cfg.weatherArgs; });
xdg.configFile."nova-shell/theme.json".source = xdg.configFile."nova-shell/theme.json".source =
let let