From f6f90790d0c56ae5979f7010e0b445ea66a32284 Mon Sep 17 00:00:00 2001 From: Antoine POPINEAU Date: Fri, 17 May 2024 16:50:25 +0200 Subject: [PATCH] Select first session found by default (#141). --- src/greeter.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/greeter.rs b/src/greeter.rs index c64d230..5a367e5 100644 --- a/src/greeter.rs +++ b/src/greeter.rs @@ -204,9 +204,17 @@ impl Greeter { greeter.parse_options().await; + let sessions = get_sessions(&greeter).unwrap_or_default(); + + if let SessionSource::None = greeter.session_source { + if !sessions.is_empty() { + greeter.session_source = SessionSource::Session(0); + } + } + greeter.sessions = Menu { title: fl!("title_session"), - options: get_sessions(&greeter).unwrap_or_default(), + options: sessions, selected: 0, };