diff --git a/flake.nix b/flake.nix index 40c56a8..1d1bd14 100644 --- a/flake.nix +++ b/flake.nix @@ -48,7 +48,7 @@ pname = "hyprman"; version = "unstable"; src = cleanSource ./.; - nimbleDepsHash = "sha256-OqyB91B9bjyZXavb4Ikv2wMpH8UPsTGn2dmqiX8IFT0="; + nimbleDepsHash = "sha256-tDhf7CrHtgtu9NNFzp3swnfeMYBFrvHsFwR0JeYul7Q="; }; }); formatter = forAllSystems (pkgs: pkgs.nixfmt-rfc-style); diff --git a/hyprman.nimble b/hyprman.nimble index 1ad017e..2c2999c 100644 --- a/hyprman.nimble +++ b/hyprman.nimble @@ -13,4 +13,4 @@ bin = @["hyprman"] requires "nim >= 2.0.8" requires "yaml" requires "jsony" -requires "https://github.com/daylinmorgan/hwylterm#65a952e" +requires "https://github.com/daylinmorgan/hwylterm#f1cc95f8" diff --git a/nimble.lock b/nimble.lock index 6ba2716..918798d 100644 --- a/nimble.lock +++ b/nimble.lock @@ -3,12 +3,12 @@ "packages": { "hwylterm": { "version": "0.1.0", - "vcsRevision": "65a952e9f0d75659d39f8a3b146753e291ee0a66", + "vcsRevision": "f1cc95f86edcc00665fc8280f57edc0e83d461f9", "url": "https://github.com/daylinmorgan/hwylterm", "downloadMethod": "git", "dependencies": [], "checksums": { - "sha1": "10894d492bbe1d0ea32ee9bb0686abfcd3b0b0fe" + "sha1": "433522bac3b8f3caae252a1a42867ed8dc91f4d2" } }, "jsony": { diff --git a/src/hyprman.nim b/src/hyprman.nim index bc9f38f..6b6b575 100644 --- a/src/hyprman.nim +++ b/src/hyprman.nim @@ -1,6 +1,6 @@ ## hyprman, the hyprland companion -import std/[osproc, strformat] +import std/[os, osproc, strformat] import hwylterm/hwylcli import ./[ hyprland, @@ -10,8 +10,17 @@ import ./[ hwylCli: name "hyprman" + flags: + [global] + config: + i configPath + T string + ? "path to config file" + * (getConfigDir() / "hyprman" / "config.yml") + - c + preSub: + config.load(configPath) subcommands: - [mako] ... "interact with mako" flags: @@ -19,7 +28,6 @@ hwylCli: T int ? "# of notifications" * 10 - - c json: ? "output as json" - j diff --git a/src/lib.nim b/src/lib.nim index 7afffeb..79ef5fc 100644 --- a/src/lib.nim +++ b/src/lib.nim @@ -20,12 +20,13 @@ type `no-client`*: string `default-icon`*: string -proc loadConfig*(): Config = - let configPath = getConfigDir() / "hyprman" / "config.yml" - if fileExists(configPath): - var s = newFileStream(configPath) - load(s, result) - result.wallpapers = expandTilde(result.wallpapers) +var config*: Config + +proc load*(c: var Config, p: string) = + if fileExists(p): + var s = newFileStream(p) + load(s, c) + c.wallpapers = expandTilde(c.wallpapers) func pickIcon*( c: Config, @@ -35,5 +36,3 @@ func pickIcon*( if class in k: result = v if result == "": result = c.`default-icon` - -let config* = loadConfig()