diff --git a/Cargo.lock b/Cargo.lock index c2ec85a..59b1f00 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1094,7 +1094,7 @@ dependencies = [ [[package]] name = "cosmic-applets-config" -version = "1.0.15" +version = "1.3.0" dependencies = [ "cosmic-config", "serde", @@ -1167,6 +1167,7 @@ dependencies = [ [[package]] name = "cosmic-dbus-a11y" version = "0.1.0" +source = "git+https://github.com/pop-os/dbus-settings-bindings#eed01dd3609e90e3c8cd043656734c500956c793" dependencies = [ "zbus", ] @@ -1297,7 +1298,7 @@ dependencies = [ [[package]] name = "cosmic-randr-shell" -version = "0.1.0" +version = "1.3.0" dependencies = [ "kdl", "slotmap", diff --git a/Cargo.toml b/Cargo.toml index ff4eb29..170acb4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cosmic-greeter" -version = "1.3.0" +version = "0.1.0" edition = "2024" [build-dependencies] @@ -88,7 +88,7 @@ image = { version = "0.25", default-features = false, features = [ ] } [dependencies.greetd_ipc] -version = "1.3.0" +version = "0.10.3" features = ["tokio-codec"] [features] diff --git a/daemon/src/lib.rs b/daemon/src/lib.rs index 842aebe..e01885f 100644 --- a/daemon/src/lib.rs +++ b/daemon/src/lib.rs @@ -230,16 +230,34 @@ impl UserData { } }; - let xdg = xdg::BaseDirectories::new(); - self.kdl_output_lists = xdg - .get_state_home() - .map(|mut s| { - s.push("cosmic-comp/outputs.ron"); - let lists = randr::load_outputs(Some(&s)); - lists - .into_iter() - .map(|l| KdlDocument::from(l).to_string()) - .collect() + // Resolve the user's home directory from pwd (not HOME env var, since + // the daemon runs as root without HOME defined). Then load outputs.ron + // from ~/.local/state/cosmic-comp/outputs.ron for this specific user. + let output_path = pwd::Passwd::from_name(&self.name) + .ok() + .flatten() + .map(|u| { + let mut p = PathBuf::from(u.dir); + p.push(".local"); + p.push("state"); + p.push("cosmic-comp"); + p.push("outputs.ron"); + p + }); + self.kdl_output_lists = output_path + .as_ref() + .and_then(|p| { + if p.exists() { + let lists = randr::load_outputs(Some(p)); + Some( + lists + .into_iter() + .map(|l| KdlDocument::from(l).to_string()) + .collect(), + ) + } else { + None + } }) .unwrap_or_default();