fix(daemon): resolve outputs.ron from the user's passwd home

The greeter daemon runs as root without HOME set, so
xdg::BaseDirectories resolved the state dir against root's
environment and never found the user's cosmic-comp output layout.
The greeter therefore came up with the default monitor arrangement
instead of the saved one.

Resolve the home directory from the passwd entry of the user being
described, read ~/.local/state/cosmic-comp/outputs.ron directly, and
fall back to an empty list when the file is absent.

Also revert the two version fields that the 1.3.0 bulk bump rewrote by
mistake: greetd_ipc has no 1.3.0 release, and the crate version is kept
at 0.1.0 to stay consistent with Cargo.lock so --locked builds work.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Lionel DARNIS 2026-08-07 16:29:20 +02:00
parent e5cbc819e8
commit bf630a4b57
3 changed files with 33 additions and 14 deletions

5
Cargo.lock generated
View file

@ -1094,7 +1094,7 @@ dependencies = [
[[package]] [[package]]
name = "cosmic-applets-config" name = "cosmic-applets-config"
version = "1.0.15" version = "1.3.0"
dependencies = [ dependencies = [
"cosmic-config", "cosmic-config",
"serde", "serde",
@ -1167,6 +1167,7 @@ dependencies = [
[[package]] [[package]]
name = "cosmic-dbus-a11y" name = "cosmic-dbus-a11y"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/pop-os/dbus-settings-bindings#eed01dd3609e90e3c8cd043656734c500956c793"
dependencies = [ dependencies = [
"zbus", "zbus",
] ]
@ -1297,7 +1298,7 @@ dependencies = [
[[package]] [[package]]
name = "cosmic-randr-shell" name = "cosmic-randr-shell"
version = "0.1.0" version = "1.3.0"
dependencies = [ dependencies = [
"kdl", "kdl",
"slotmap", "slotmap",

View file

@ -1,6 +1,6 @@
[package] [package]
name = "cosmic-greeter" name = "cosmic-greeter"
version = "1.3.0" version = "0.1.0"
edition = "2024" edition = "2024"
[build-dependencies] [build-dependencies]
@ -88,7 +88,7 @@ image = { version = "0.25", default-features = false, features = [
] } ] }
[dependencies.greetd_ipc] [dependencies.greetd_ipc]
version = "1.3.0" version = "0.10.3"
features = ["tokio-codec"] features = ["tokio-codec"]
[features] [features]

View file

@ -230,16 +230,34 @@ impl UserData {
} }
}; };
let xdg = xdg::BaseDirectories::new(); // Resolve the user's home directory from pwd (not HOME env var, since
self.kdl_output_lists = xdg // the daemon runs as root without HOME defined). Then load outputs.ron
.get_state_home() // from ~/.local/state/cosmic-comp/outputs.ron for this specific user.
.map(|mut s| { let output_path = pwd::Passwd::from_name(&self.name)
s.push("cosmic-comp/outputs.ron"); .ok()
let lists = randr::load_outputs(Some(&s)); .flatten()
lists .map(|u| {
.into_iter() let mut p = PathBuf::from(u.dir);
.map(|l| KdlDocument::from(l).to_string()) p.push(".local");
.collect() 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(); .unwrap_or_default();