Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use startup command from /usr/share/xsession if DISPLAY_SESSION is set #2522

Merged

Conversation

akarl10
Copy link
Contributor

@akarl10 akarl10 commented Jan 29, 2023

gnome shell has a way to start different desktop profiles, but all use the same gnome-session binary.

also XDG somehow expects that the DESKTOP_SESSION environment variable is set. This value is derived from the .desktop file name in /usr/share/xsessions

There is also a XDG_CURRENT_DESKTOP that comes from that file

on debian/ubuntu setting STARTUP should work, not sure about other distros.

@akarl10 akarl10 force-pushed the startwm-xsession-desktop-files branch 3 times, most recently from be83119 to 46b5a40 Compare January 29, 2023 16:58
@akarl10 akarl10 changed the title [WIP] try using startup command in /usr/share/xsessions use startup command from /usr/share/xsession if DISPLAY_SESSION is set Jan 30, 2023
@matt335672
Copy link
Member

The intention of this (if I'm reading it right) is to give a system manager the chance to force user of a particular desktop. Is that right?

@akarl10
Copy link
Contributor Author

akarl10 commented Jan 31, 2023

kind of right.
nowadays "login screen" managers like gdm or sddm take the launch command from from /usr/share/xsessions and dont use x-session-manager

if you look for example what gnome defines:

[Desktop Entry]
Name=Ubuntu on Xorg
Comment=This session logs you into Ubuntu
Exec=env GNOME_SHELL_SESSION_MODE=ubuntu /usr/bin/gnome-session --session=ubuntu
TryExec=/usr/bin/gnome-shell
Type=Application
DesktopNames=ubuntu:GNOME
X-GDM-SessionRegisters=true
X-Ubuntu-Gettext-Domain=gnome-session-43

you see that the launch command also contains parameters and in that case environment variables.
if you look at #1723 you see that XDG_CURRENT_DESKTOP is initialized by DesktopNames.

Copy link
Member

@matt335672 matt335672 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One suggestion:-

sesman/startwm.sh Outdated Show resolved Hide resolved
@akarl10 akarl10 marked this pull request as draft February 1, 2023 10:33
@akarl10 akarl10 marked this pull request as ready for review February 1, 2023 12:41
Copy link
Member

@matt335672 matt335672 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two minor comments

STARTUP=${STARTUP#Exec=*}
XDG_CURRENT_DESKTOP=$(grep ^DesktopNames= "/usr/share/xsessions/$1.desktop")
XDG_CURRENT_DESKTOP=${XDG_CURRENT_DESKTOP#DesktopNames=*}
echo "env XDG_CURRENT_DESKTOP=$XDG_CURRENT_DESKTOP $STARTUP"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggest echo "env XDG_CURRENT_DESKTOP=\"$XDG_CURRENT_DESKTOP \" $STARTUP", to add "" to the XDG_CURRENT_DESKTOP

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

true

sesman/startwm.sh Outdated Show resolved Hide resolved
@matt335672
Copy link
Member

LGTM.

Do you want to squash it into a single commit? Then I'll merge it.

@akarl10 akarl10 force-pushed the startwm-xsession-desktop-files branch from cf108ab to bbf3261 Compare February 2, 2023 13:53
gnome shell has a way to start different desktop profiles, but all
use the same gnome-session binary.

currently implemented only for debian based distributions
@akarl10 akarl10 force-pushed the startwm-xsession-desktop-files branch from bbf3261 to 093baad Compare February 2, 2023 13:55
@matt335672 matt335672 merged commit 04a9c76 into neutrinolabs:devel Feb 2, 2023
@akarl10 akarl10 deleted the startwm-xsession-desktop-files branch February 2, 2023 14:29
Hiero32 added a commit to Hiero32/xrdp that referenced this pull request Feb 18, 2023
matt335672 added a commit that referenced this pull request Feb 22, 2023
improve "#2522 use startup command from /usr/share/xsession ..."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants