From 40caced03cb41bd5ee681057c7e184b47ecd1c1e Mon Sep 17 00:00:00 2001 From: Luke Yue Date: Tue, 4 Aug 2020 19:51:01 +0800 Subject: [PATCH] Add Xsession Wrapper for lightdm Signed-off-by: Luke Yue --- 50-session-wrapper.conf | 2 +- Xsession | 64 +++++++++++++++++++++++++++++++++++++++++ lightdm.spec | 12 +++++++- 3 files changed, 76 insertions(+), 2 deletions(-) create mode 100644 Xsession diff --git a/50-session-wrapper.conf b/50-session-wrapper.conf index 36a66ef..c4f3cee 100644 --- a/50-session-wrapper.conf +++ b/50-session-wrapper.conf @@ -1,2 +1,2 @@ [Seat:*] -session-wrapper=/etc/X11/xinit/Xsession +session-wrapper=/etc/lightdm/Xsession diff --git a/Xsession b/Xsession new file mode 100644 index 0000000..4a2a25e --- /dev/null +++ b/Xsession @@ -0,0 +1,64 @@ +#!/bin/sh +# +# LightDM wrapper to run around X sessions. + +echo "Running X session wrapper" + +# Load profile +for file in "/etc/profile" "$HOME/.profile" "/etc/xprofile" "$HOME/.xprofile"; do + if [ -f "$file" ]; then + echo "Loading profile from $file"; + . "$file" + fi +done + +# Load resources +for file in "/etc/X11/Xresources" "$HOME/.Xresources"; do + if [ -f "$file" ]; then + echo "Loading resource: $file" + xrdb -merge "$file" + fi +done + +# Load keymaps +for file in "/etc/X11/Xkbmap" "$HOME/.Xkbmap"; do + if [ -f "$file" ]; then + echo "Loading keymap: $file" + setxkbmap `cat "$file"` + XKB_IN_USE=yes + fi +done + +# Load xmodmap if not using XKB +if [ -z "$XKB_IN_USE" ]; then + for file in "/etc/X11/Xmodmap" "$HOME/.Xmodmap"; do + if [ -f "$file" ]; then + echo "Loading modmap: $file" + xmodmap "$file" + fi + done +fi + +unset XKB_IN_USE + +# Run all system xinitrc shell scripts +xinitdir="/etc/X11/xinit/xinitrc.d" +if [ -d "$xinitdir" ]; then + for script in $xinitdir/*; do + echo "Loading xinit script $script" + if [ -x "$script" -a ! -d "$script" ]; then + . "$script" + fi + done +fi + +# Run user xsession shell script +script="$HOME/.xsession" +if [ -x "$script" -a ! -d "$script" ]; then + echo "Loading xsession script $script" + . "$script" +fi + +echo "X session wrapper complete, running session $@" + +exec $@ diff --git a/lightdm.spec b/lightdm.spec index 8274546..8a0cc3a 100644 --- a/lightdm.spec +++ b/lightdm.spec @@ -7,7 +7,7 @@ Name: lightdm Summary: A cross-desktop Display Manager Version: 1.30.0 -Release: 6 +Release: 7 # library/bindings are LGPLv2 or LGPLv3, the rest GPLv3+ License: (LGPLv2 or LGPLv3) and GPLv3+ @@ -32,6 +32,9 @@ Source25: 50-disable-guest.conf Source26: 50-remove-wayland-session.conf Source27: 50-run-directory.conf +# X session wrapper +Source30: Xsession + # Upstreamed: Patch0: %{giturl}/pull/5.patch#/lightdm-1.25.1-disable_dmrc.patch @@ -197,6 +200,9 @@ rm -fv %{buildroot}%{_libdir}/lib*.la %{__install} -pm 0644 %{SOURCE20} %{SOURCE21} %{SOURCE22} %{SOURCE23} \ %{SOURCE24} %{SOURCE25} %{SOURCE26} %{SOURCE27} %{buildroot}%{_datadir}/lightdm/lightdm.conf.d/ +# Install Xsession file +%{__install} -pm 0755 %{SOURCE30} %{buildroot}%{_sysconfdir}/lightdm/Xsession + # Move DBus config to proper location. # why is this needed? -- rex %{__mv} -f %{buildroot}%{_sysconfdir}/dbus-1/system.d/*.conf \ @@ -235,6 +241,7 @@ fi %doc NEWS %dir %{_sysconfdir}/lightdm/ %dir %{_sysconfdir}/lightdm/lightdm.conf.d +%{_sysconfdir}/lightdm/Xsession %config(noreplace) %{_sysconfdir}/pam.d/lightdm* %config(noreplace) %{_sysconfdir}/lightdm/keys.conf %config(noreplace) %{_sysconfdir}/lightdm/lightdm.conf @@ -306,5 +313,8 @@ fi %changelog +* Tue Aug 04 2020 Luke Yue - 1.30.0-7 +- Add Xsession Wrapper for lightdm + * Thu Jul 09 2020 douyan - 1.30.0-6 - Package init for openEuler -- Gitee