diff mbox series

[PATCHv11,6/6] xsessions: add unique desktop entries

Message ID 20251216203803.3870049-7-rs@ti.com
State New
Headers show
Series Display manager proposal for x11 and wayland | expand

Commit Message

Randolph Sapp Dec. 16, 2025, 8:38 p.m. UTC
From: Randolph Sapp <rs@ti.com>

Now that we have a display manager, users can have the option to choose
a session manager with the default emptty configuration. Currently this
could be either mini-x-session or matchbox-session.

Previously, only one was selectable via update-alternatives logic
switching out the x-session-manager link that xserver-nodm-init would
unconditionally use. From my testing this normally resulted in
matchbox-session being chosen.

Now xserver-nodm-init will use a DEFAULT_SESSION variable to configure
the automatic login session, and both of these session managers will
provide unique desktop entries for their respective sessions.

The loose default for DEFAULT_SESSION will be matchbox-session to keep
in line with the existing behavior.

Signed-off-by: Randolph Sapp <rs@ti.com>
---
 .../matchbox-session/matchbox-session.desktop       |  6 ++++++
 .../matchbox-session/matchbox-session_0.1.bb        | 13 ++++++-------
 .../mini-x-session/files/mini-x-session.desktop     |  6 ++++++
 .../mini-x-session/mini-x-session_0.1.bb            | 13 ++++++-------
 .../x11-common/xserver-nodm-init/default.desktop    |  5 -----
 .../x11-common/xserver-nodm-init/emptty.conf.in     |  2 +-
 .../x11-common/xserver-nodm-init_3.0.bb             |  7 ++++---
 7 files changed, 29 insertions(+), 23 deletions(-)
 create mode 100644 meta/recipes-graphics/matchbox-session/matchbox-session/matchbox-session.desktop
 create mode 100644 meta/recipes-graphics/mini-x-session/files/mini-x-session.desktop
 delete mode 100644 meta/recipes-graphics/x11-common/xserver-nodm-init/default.desktop
diff mbox series

Patch

diff --git a/meta/recipes-graphics/matchbox-session/matchbox-session/matchbox-session.desktop b/meta/recipes-graphics/matchbox-session/matchbox-session/matchbox-session.desktop
new file mode 100644
index 0000000000..f496fd860f
--- /dev/null
+++ b/meta/recipes-graphics/matchbox-session/matchbox-session/matchbox-session.desktop
@@ -0,0 +1,6 @@ 
+[Desktop Entry]
+Name=Matchbox Session
+Comment=Very simple session manager for matchbox tools
+Type=Application
+Exec=matchbox-session
+DesktopNames=matchbox
diff --git a/meta/recipes-graphics/matchbox-session/matchbox-session_0.1.bb b/meta/recipes-graphics/matchbox-session/matchbox-session_0.1.bb
index d8be3417cc..bee18ad617 100644
--- a/meta/recipes-graphics/matchbox-session/matchbox-session_0.1.bb
+++ b/meta/recipes-graphics/matchbox-session/matchbox-session_0.1.bb
@@ -9,17 +9,16 @@  LIC_FILES_CHKSUM = "file://matchbox-session;endline=20;md5=180f1c169a15d059a56c3
 SECTION = "x11"
 RCONFLICTS:${PN} = "matchbox-common"
 
-SRC_URI = "file://matchbox-session"
+SRC_URI = "file://matchbox-session \
+           file://matchbox-session.desktop"
 
 S = "${UNPACKDIR}"
 
-inherit update-alternatives
-
-ALTERNATIVE:${PN} = "x-session-manager"
-ALTERNATIVE_TARGET[x-session-manager] = "${bindir}/matchbox-session"
-ALTERNATIVE_PRIORITY = "100"
-
 do_install() {
 	install -d ${D}/${bindir}
 	install -m 0755 ${S}/matchbox-session ${D}/${bindir}
+	install -d ${D}${datadir}/xsessions
+	install -m 0644 ${S}/matchbox-session.desktop ${D}${datadir}/xsessions
 }
+
+FILES:${PN} += "${datadir}/xsessions"
diff --git a/meta/recipes-graphics/mini-x-session/files/mini-x-session.desktop b/meta/recipes-graphics/mini-x-session/files/mini-x-session.desktop
new file mode 100644
index 0000000000..d7afed9cfd
--- /dev/null
+++ b/meta/recipes-graphics/mini-x-session/files/mini-x-session.desktop
@@ -0,0 +1,6 @@ 
+[Desktop Entry]
+Name=Mini X Session
+Comment=Very simple session manager for X
+Type=Application
+Exec=mini-x-session
+DesktopNames=matchbox
diff --git a/meta/recipes-graphics/mini-x-session/mini-x-session_0.1.bb b/meta/recipes-graphics/mini-x-session/mini-x-session_0.1.bb
index e90786df44..b223c38c9e 100644
--- a/meta/recipes-graphics/mini-x-session/mini-x-session_0.1.bb
+++ b/meta/recipes-graphics/mini-x-session/mini-x-session_0.1.bb
@@ -9,19 +9,18 @@  LIC_FILES_CHKSUM = "file://mini-x-session;endline=5;md5=b6430bffbcf05f9760e72938
 SECTION = "x11"
 RCONFLICTS:${PN} = "matchbox-common"
 
-SRC_URI = "file://mini-x-session"
+SRC_URI = "file://mini-x-session \
+           file://mini-x-session.desktop"
 
 S = "${UNPACKDIR}"
 
 RDEPENDS:${PN} = "sudo"
 
-inherit update-alternatives
-
-ALTERNATIVE:${PN} = "x-session-manager"
-ALTERNATIVE_TARGET[x-session-manager] = "${bindir}/mini-x-session"
-ALTERNATIVE_PRIORITY = "50"
-
 do_install() {
 	install -d ${D}/${bindir}
 	install -m 0755 ${S}/mini-x-session ${D}/${bindir}
+	install -d ${D}${datadir}/xsessions
+	install -m 0644 ${S}/mini-x-session.desktop ${D}${datadir}/xsessions
 }
+
+FILES:${PN} += "${datadir}/xsessions"
diff --git a/meta/recipes-graphics/x11-common/xserver-nodm-init/default.desktop b/meta/recipes-graphics/x11-common/xserver-nodm-init/default.desktop
deleted file mode 100644
index 3357cd9a7f..0000000000
--- a/meta/recipes-graphics/x11-common/xserver-nodm-init/default.desktop
+++ /dev/null
@@ -1,5 +0,0 @@ 
-[Desktop Entry]
-Encoding=UTF-8
-Type=Application
-Name=Default X11 Desktop
-Exec=x-session-manager
diff --git a/meta/recipes-graphics/x11-common/xserver-nodm-init/emptty.conf.in b/meta/recipes-graphics/x11-common/xserver-nodm-init/emptty.conf.in
index bdb3bec782..fbe106d9b6 100644
--- a/meta/recipes-graphics/x11-common/xserver-nodm-init/emptty.conf.in
+++ b/meta/recipes-graphics/x11-common/xserver-nodm-init/emptty.conf.in
@@ -17,7 +17,7 @@  DEFAULT_USER=xuser
 AUTOLOGIN=true
 
 # The default session used, if Autologin is enabled. If session is not found in list of session, it proceeds to manual selection.
-AUTOLOGIN_SESSION=Default X11 Desktop
+AUTOLOGIN_SESSION=@DEFAULT_SESSION@
 
 # If Autologin is enabled and session does not start correctly, the number of retries in short period is kept to eventually stop the infinite loop of restarts. -1 is for infinite retries, 0 is for no retry.
 # AUTOLOGIN_MAX_RETRY=2
diff --git a/meta/recipes-graphics/x11-common/xserver-nodm-init_3.0.bb b/meta/recipes-graphics/x11-common/xserver-nodm-init_3.0.bb
index 0e9fe1e65a..a4b4a11d1b 100644
--- a/meta/recipes-graphics/x11-common/xserver-nodm-init_3.0.bb
+++ b/meta/recipes-graphics/x11-common/xserver-nodm-init_3.0.bb
@@ -4,7 +4,6 @@  LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384
 SECTION = "x11"
 
 SRC_URI = "file://emptty.conf.in \
-           file://default.desktop \
            file://system-xuser.conf"
 
 S = "${UNPACKDIR}"
@@ -18,21 +17,23 @@  PACKAGECONFIG ??= "blank"
 PACKAGECONFIG[blank] = ""
 PACKAGECONFIG[nocursor] = ""
 
+# matchbox-session seems to be the current preferred session provider
+DEFAULT_SESSION ??= "matchbox-session"
+
 do_install() {
     install -D -p -m0644 ${S}/emptty.conf.in ${D}${sysconfdir}/emptty/conf
-    install -D -p -m0644 ${S}/default.desktop ${D}${datadir}/xsessions/default.desktop
 
     BLANK_ARGS="${@bb.utils.contains('PACKAGECONFIG', 'blank', '', '-s 0 -dpms', d)}"
     NO_CURSOR_ARG="${@bb.utils.contains('PACKAGECONFIG', 'nocursor', '-nocursor', '', d)}"
 
     sed -i "s:@NO_CURSOR_ARG@:${NO_CURSOR_ARG}:" ${D}${sysconfdir}/emptty/conf
     sed -i "s:@BLANK_ARGS@:${BLANK_ARGS}:" ${D}${sysconfdir}/emptty/conf
+    sed -i "s:@DEFAULT_SESSION@:${DEFAULT_SESSION}:" ${D}${sysconfdir}/emptty/conf
 
     install -D -m 0644 ${S}/system-xuser.conf ${D}${sysconfdir}/dbus-1/system.d/system-xuser.conf
 }
 
 FILES:${PN} = "${sysconfdir}/emptty/conf \
-               ${datadir}/xsessions/default.desktop \
                ${sysconfdir}/dbus-1/system.d/system-xuser.conf"
 
 USERADD_PACKAGES = "${PN}"