From 5364ee6aafa1b7175175b61b93daadb147825987 Mon Sep 17 00:00:00 2001 From: Hiero32 <112747353+Hiero32@users.noreply.github.com> Date: Sat, 18 Feb 2023 10:04:27 +0900 Subject: [PATCH 1/4] improve "#2522 use startup command from /usr/share/xsession ..." --- sesman/startwm.sh | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/sesman/startwm.sh b/sesman/startwm.sh index fd0535ca..420f18ea 100755 --- a/sesman/startwm.sh +++ b/sesman/startwm.sh @@ -59,13 +59,17 @@ get_xdg_session_startupcmd() { # DESKTOP_SESSION should be set in sesman.ini in the SessionVariables section. # If set and valid then the STARTUP command will be taken from there + # GDM exports environment variables XDG_CURRENT_DESKTOP and XDG_SESSION_DESKTOP. + # This follows it. if [ -n "$1" ] && [ -d /usr/share/xsessions ] \ && [ -f "/usr/share/xsessions/$1.desktop" ]; then STARTUP=$(grep ^Exec= "/usr/share/xsessions/$1.desktop") 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" + XDG_CURRENT_DESKTOP=${XDG_CURRENT_DESKTOP//;/:} + export XDG_CURRENT_DESKTOP + export XDG_SESSION_DESKTOP="$DESKTOP_SESSION" fi } @@ -80,15 +84,23 @@ wm_start() # debian if [ -r /etc/X11/Xsession ]; then pre_start - + + # if /etc/xrdp/export_desktop_session file exists, souurce it. + # /etc/xrdp/export_desktop_session script exports DESKTOP_SESSION environment varible + # The value shall be one of "ls -1 /usr/share/xsessions|cut -d. -f1". + # e.g. export DESKTOP_SESSION=ubuntu + if [ -r /etc/xrdp/export_desktop_session ]; then + . /etc/xrdp/export_desktop_session + fi + # STARTUP is the default startup command. # if $1 is empty and STARTUP was not set # /etc/X11/Xsession.d/50x11-common_determine-startup will fallback to # x-session-manager if [ -z "$STARTUP" ] && [ -n "$DESKTOP_SESSION" ]; then - STARTUP="$(get_xdg_session_startupcmd "$DESKTOP_SESSION")" + get_xdg_session_startupcmd "$DESKTOP_SESSION" fi - + . /etc/X11/Xsession post_start exit 0 From fda1ed004251b9e81d2cbd49f0b56cb5dc2d089a Mon Sep 17 00:00:00 2001 From: Hiero32 <112747353+Hiero32@users.noreply.github.com> Date: Tue, 21 Feb 2023 21:15:21 +0900 Subject: [PATCH 2/4] remove "source /etc/xrdp/export_desktop_session" --- sesman/startwm.sh | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/sesman/startwm.sh b/sesman/startwm.sh index 420f18ea..6c22693d 100755 --- a/sesman/startwm.sh +++ b/sesman/startwm.sh @@ -85,13 +85,14 @@ wm_start() if [ -r /etc/X11/Xsession ]; then pre_start - # if /etc/xrdp/export_desktop_session file exists, souurce it. - # /etc/xrdp/export_desktop_session script exports DESKTOP_SESSION environment varible - # The value shall be one of "ls -1 /usr/share/xsessions|cut -d. -f1". - # e.g. export DESKTOP_SESSION=ubuntu - if [ -r /etc/xrdp/export_desktop_session ]; then - . /etc/xrdp/export_desktop_session - fi + # if you want to start preferred desktop environment, + # add following line, + # [ -n "$XRDP_SESSION" ] && export DESKTOP_SESSION= + # in either of following file. + # 1. ~/.profile + # 2. create a file (any filename is OK) in /etc/profile.d + # shall be one of "ls -1 /usr/share/xsessions/" + # e.g. [ -n "$XRDP_SESSION" ] && export DESKTOP_SESSION==ubuntu # STARTUP is the default startup command. # if $1 is empty and STARTUP was not set From a2a8a0ba89a4708db074a800073541a5d9ed533d Mon Sep 17 00:00:00 2001 From: Hiero32 <112747353+Hiero32@users.noreply.github.com> Date: Tue, 21 Feb 2023 21:30:33 +0900 Subject: [PATCH 3/4] fix comment --- sesman/startwm.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sesman/startwm.sh b/sesman/startwm.sh index 6c22693d..3d42fdae 100755 --- a/sesman/startwm.sh +++ b/sesman/startwm.sh @@ -91,8 +91,8 @@ wm_start() # in either of following file. # 1. ~/.profile # 2. create a file (any filename is OK) in /etc/profile.d - # shall be one of "ls -1 /usr/share/xsessions/" - # e.g. [ -n "$XRDP_SESSION" ] && export DESKTOP_SESSION==ubuntu + # shall be one of "ls -1 /usr/share/xsessions/|cut -d. -f1" + # e.g. [ -n "$XRDP_SESSION" ] && export DESKTOP_SESSION=ubuntu # STARTUP is the default startup command. # if $1 is empty and STARTUP was not set From cdc65db4873d0a2ab07f10dafd7388e30fd5556f Mon Sep 17 00:00:00 2001 From: Hiero32 <112747353+Hiero32@users.noreply.github.com> Date: Wed, 22 Feb 2023 20:59:37 +0900 Subject: [PATCH 4/4] change comment a bit --- sesman/startwm.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/sesman/startwm.sh b/sesman/startwm.sh index 3d42fdae..7c39f24c 100755 --- a/sesman/startwm.sh +++ b/sesman/startwm.sh @@ -57,8 +57,7 @@ post_start() get_xdg_session_startupcmd() { - # DESKTOP_SESSION should be set in sesman.ini in the SessionVariables section. - # If set and valid then the STARTUP command will be taken from there + # If DESKTOP_SESSION is set and valid then the STARTUP command will be taken from there # GDM exports environment variables XDG_CURRENT_DESKTOP and XDG_SESSION_DESKTOP. # This follows it. if [ -n "$1" ] && [ -d /usr/share/xsessions ] \ @@ -90,7 +89,7 @@ wm_start() # [ -n "$XRDP_SESSION" ] && export DESKTOP_SESSION= # in either of following file. # 1. ~/.profile - # 2. create a file (any filename is OK) in /etc/profile.d + # 2. create a file (any_filename.sh is OK) in /etc/profile.d # shall be one of "ls -1 /usr/share/xsessions/|cut -d. -f1" # e.g. [ -n "$XRDP_SESSION" ] && export DESKTOP_SESSION=ubuntu