Add breadgreet session picker for installed Wayland sessions

List .desktop sessions from the existing scan, pre-select bos when
present (else the first entry), and pass the chosen Exec= argv to
greetd StartSession.
This commit is contained in:
Breadway 2026-08-15 23:55:32 +08:00
parent 80caedc7fd
commit 495fe1aaad
6 changed files with 151 additions and 50 deletions

View file

@ -15,7 +15,8 @@ pub struct Config {
pub struct Sessions {
pub wayland_dirs: Vec<String>,
pub xsessions_dirs: Vec<String>,
/// `.desktop` file stem (without extension) to auto-select.
/// `.desktop` file stem (without extension) to pre-select in the picker.
/// Falls back to the first discovered session if this stem is missing.
pub default: String,
}
@ -24,7 +25,7 @@ impl Default for Sessions {
Self {
wayland_dirs: vec!["/usr/share/wayland-sessions".to_string()],
xsessions_dirs: vec!["/usr/share/xsessions".to_string()],
default: "hyprland".to_string(),
default: "bos".to_string(),
}
}
}
@ -58,6 +59,6 @@ mod tests {
let s = Sessions::default();
assert_eq!(s.wayland_dirs, vec!["/usr/share/wayland-sessions"]);
assert_eq!(s.xsessions_dirs, vec!["/usr/share/xsessions"]);
assert_eq!(s.default, "hyprland");
assert_eq!(s.default, "bos");
}
}