fix: config path, window class escaping, debug ordering
All checks were successful
Nix Build / nix build (push) Successful in 35s

This commit is contained in:
atagen 2026-03-03 00:17:51 +11:00
parent 18f145e04a
commit 785619920b
2 changed files with 19 additions and 16 deletions

View file

@ -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();