From 3a6ba994c5b3abefe7b528c0aa93685fd7cb39bf Mon Sep 17 00:00:00 2001 From: Damocles Date: Sun, 12 Apr 2026 15:20:38 +0200 Subject: [PATCH] weather options --- modules/Modules.qml | 4 ++++ modules/Weather.qml | 2 +- nix/hm-module.nix | 14 +++++++++++++- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/modules/Modules.qml b/modules/Modules.qml index b7645f6..c8c6d1d 100644 --- a/modules/Modules.qml +++ b/modules/Modules.qml @@ -27,6 +27,8 @@ QtObject { property bool battery: true property bool wlogout: true + property var weatherArgs: ["--nerd"] + property FileView _file: FileView { path: (Quickshell.env("XDG_CONFIG_HOME") || (Quickshell.env("HOME") + "/.config")) + "/nova-shell/modules.json" watchChanges: true @@ -45,5 +47,7 @@ QtObject { if (k in root && typeof root[k] === "boolean") root[k] = data[k]; } + if (Array.isArray(data.weatherArgs)) + root.weatherArgs = data.weatherArgs; } } diff --git a/modules/Weather.qml b/modules/Weather.qml index b8d03d0..11b002c 100644 --- a/modules/Weather.qml +++ b/modules/Weather.qml @@ -12,7 +12,7 @@ M.BarSection { Process { id: proc running: true - command: ["wttrbar", "--nerd"] + command: ["wttrbar"].concat(M.Modules.weatherArgs) stdout: StdioCollector { onStreamFinished: { try { diff --git a/nix/hm-module.nix b/nix/hm-module.nix index eb27d33..0f00a76 100644 --- a/nix/hm-module.nix +++ b/nix/hm-module.nix @@ -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 { type = lib.types.attrsOf lib.types.anything; default = { }; @@ -120,7 +131,8 @@ in ++ lib.optional cfg.modules.weather pkgs.wttrbar; 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 = let