gardesk/gardm / f9341b4

Browse files

Enable Wayland session discovery

Enumerate sessions from /usr/share/wayland-sessions/ in addition
to X11 sessions. Each session is tagged with its type (x11/wayland)
for the daemon to handle appropriately.
Authored by mfwolffe <wolffemf@dukes.jmu.edu>
SHA
f9341b4c1080b9928703e472b7dc02a28e05581d
Parents
0c6065d
Tree
bd6903e

1 changed file

StatusFile+-
M gardmd/src/sessions.rs 14 3
gardmd/src/sessions.rsmodified
@@ -25,12 +25,12 @@ const MIN_UID: u32 = 1000;
2525
 const MAX_UID: u32 = 60000;
2626
 
2727
 /// Enumerate available sessions from .desktop files
28
-/// Note: Only X11 sessions are listed since gardm runs an X server.
29
-/// Wayland compositors need to be started differently and can't run on X11.
28
+/// Returns both X11 and Wayland sessions. The daemon handles launching
29
+/// each session type appropriately (X11 on existing server, Wayland directly on VT).
3030
 pub fn list_sessions() -> Vec<SessionInfo> {
3131
     let mut sessions = Vec::new();
3232
 
33
-    // X11 sessions only (Wayland sessions can't run on our X server)
33
+    // X11 sessions
3434
     for dir in XSESSION_DIRS {
3535
         if let Ok(entries) = fs::read_dir(dir) {
3636
             for entry in entries.flatten() {
@@ -41,6 +41,17 @@ pub fn list_sessions() -> Vec<SessionInfo> {
4141
         }
4242
     }
4343
 
44
+    // Wayland sessions
45
+    for dir in WAYLAND_SESSION_DIRS {
46
+        if let Ok(entries) = fs::read_dir(dir) {
47
+            for entry in entries.flatten() {
48
+                if let Some(session) = parse_desktop_file(&entry.path(), "wayland") {
49
+                    sessions.push(session);
50
+                }
51
+            }
52
+        }
53
+    }
54
+
4455
     // Sort by name for consistent ordering
4556
     sessions.sort_by(|a, b| a.name.cmp(&b.name));
4657