firstlogin: prefer the GNOME Flashback xmonad session when it can start

The xmonad package ships two sessions: xmonad.desktop runs the window
manager bare, and gnome-flashback-xmonad.desktop runs it inside a GNOME
Flashback session, which is the one that gets a session dbus, a polkit
agent and session management. Autologin hardcoded the bare one, so the
flashback session was never selected even where it was usable.

Pick it when it can actually start, and keep the old behaviour otherwise.
Its TryExec is gnome-flashback, from gnome-session-flashback, which is
not installed on every image, so both the .desktop and the binary are
checked. Images without it are unaffected.

Signed-off-by: Igor Pecovnik <igor@armbian.com>
This commit is contained in:
Igor Pecovnik
2026-09-08 15:48:22 +02:00
committed by Igor
parent 8801cd4b65
commit ddb935698c
@@ -1093,9 +1093,21 @@ if [[ -f /root/.not_logged_in_yet ]] && tty -s; then
[[ -x $(command -v sway) ]] && sed -i "s/user-session.*/user-session=sway/" /etc/lightdm/lightdm.conf.d/11-armbian.conf
[[ -x $(command -v sway) ]] && sed -i "s/user-session.*/user-session=sway/" /etc/lightdm/lightdm.conf.d/22-armbian-autologin.conf
# select xmonad session
[[ -x $(command -v xmonad) ]] && sed -i "s/user-session.*/user-session=xmonad/" /etc/lightdm/lightdm.conf.d/11-armbian.conf
[[ -x $(command -v xmonad) ]] && sed -i "s/user-session.*/user-session=xmonad/" /etc/lightdm/lightdm.conf.d/22-armbian-autologin.conf
# select xmonad session. The xmonad package ships two of them:
# xmonad.desktop runs the window manager bare, while
# gnome-flashback-xmonad.desktop runs it inside a GNOME Flashback
# session and so gets a session dbus, a polkit agent and session
# management. Prefer the latter when it can actually start -- its
# TryExec is gnome-flashback, which comes from gnome-session-flashback
# and is not always installed -- and fall back to the bare session.
if [[ -x $(command -v xmonad) ]]; then
xmonad_session="xmonad"
if [[ -f /usr/share/xsessions/gnome-flashback-xmonad.desktop && -x $(command -v gnome-flashback) ]]; then
xmonad_session="gnome-flashback-xmonad"
fi
sed -i "s/user-session.*/user-session=${xmonad_session}/" /etc/lightdm/lightdm.conf.d/11-armbian.conf
sed -i "s/user-session.*/user-session=${xmonad_session}/" /etc/lightdm/lightdm.conf.d/22-armbian-autologin.conf
fi
ln -sf /lib/systemd/system/lightdm.service /etc/systemd/system/display-manager.service