diff --git a/daemon/main.rs b/daemon/main.rs index 994f566..4fa5d63 100644 --- a/daemon/main.rs +++ b/daemon/main.rs @@ -9,13 +9,31 @@ use microxdg::Xdg; use niri_tag::Config; fn main() -> Result<()> { + // debug stuff + let debug = env::var("NIRI_TAG_DEBUG").is_ok(); + tracing_subscriber::fmt() + .with_max_level(if debug { + tracing::Level::DEBUG + } else { + tracing::Level::INFO + }) + .init(); + let span = if debug { + tracing::span!(tracing::Level::DEBUG, "main") + } else { + tracing::span!(tracing::Level::INFO, "main") + }; + let _ = span.enter(); + // try to read a config let xdg = Xdg::new()?; let mut config_file = xdg.config()?; config_file.push("niri-tag"); config_file.push("config.toml"); if !config_file.try_exists().is_ok_and(|i| i) { + tracing::debug!("didn't find xdg location config"); config_file.clear(); + config_file.push("/"); config_file.push("etc"); config_file.push("niri-tag"); config_file.push("config.toml"); @@ -33,21 +51,6 @@ fn main() -> Result<()> { .unwrap_or_default(); // let systemd know we're ready let _ = libsystemd::daemon::notify(false, &[libsystemd::daemon::NotifyState::Ready])?; - // debug stuff - let debug = env::var("NIRI_TAG_DEBUG").is_ok(); - tracing_subscriber::fmt() - .with_max_level(if debug { - tracing::Level::DEBUG - } else { - tracing::Level::INFO - }) - .init(); - let span = if debug { - tracing::span!(tracing::Level::DEBUG, "main") - } else { - tracing::span!(tracing::Level::INFO, "main") - }; - let _ = span.enter(); // spawn socket consumer for niri event stream let (niri_tx, niri_rx) = smol::channel::unbounded(); smol::spawn(ipc::event_consumer(niri_tx)).detach(); diff --git a/module.nix b/module.nix index 516b75b..589aaf5 100644 --- a/module.nix +++ b/module.nix @@ -60,7 +60,7 @@ in scratchpads = let contents = - lib.mapAttrsToList (app: number: "${app} = ${toString number}") cfg.scratchpads + lib.mapAttrsToList (app: number: ''"${app}" = ${toString number}'') cfg.scratchpads |> lib.concatStringsSep "\n"; in lib.optionalString ((lib.attrsToList cfg.scratchpads |> builtins.length) > 0) ''