Skip to content

Instantly share code, notes, and snippets.

@marbu
Created September 13, 2015 17:40
Show Gist options
  • Save marbu/a09ed26c77704441eba3 to your computer and use it in GitHub Desktop.
Save marbu/a09ed26c77704441eba3 to your computer and use it in GitHub Desktop.
searching for xprofile

xprofile file

Raw notes about ~/.xprofile script.

Upstream

Upstream DM which executes ~/.xprofile file in Xsession script:

  • GDM (Gnome): see Xsession.in
  • KDM (KDE 4): see genkdmconf.c
  • SDDM (KDE 5): see Xsession

Upstream projects without xprofile support:

  • XDM (xorg-xdm): see xdm-1.1.11/config/Xsession.cpp
  • LightDM (no Xsession script shipped upstream)

GDM

GDM gdm-3.16.2/data/Xsession.in:

# Second read /etc/xprofile and .xprofile for X specific setup
test -f /etc/xprofile && . /etc/xprofile
test -f "$HOME/.xprofile" && . "$HOME/.xprofile"

KDM (KDE 4)

KDM changelog:

2001-06-10  Oswald Buddenhagen <ossi@kde.org>
    * The default Xsession will now
      - source ~/.xprofile if present

KDM kde-workspace-4.11.22/kdm/kfrontend/genkdmconf.c:

"[ -f $HOME/.xprofile ] && . $HOME/.xprofile\n"

SDDM (KDE 5 aka Plasma)

See sddm-0.12.0/data/scripts/Xsession:

[ -f /etc/xprofile ] && . /etc/xprofile
[ -f $HOME/.xprofile ] && . $HOME/.xprofile

Downstream: Archlinux

See https://wiki.archlinux.org/index.php/Xprofile, Arch developers make it work with other DMs as well:

  • GDM - /etc/gdm/Xsession (downstream)
  • KDM - /usr/share/config/kdm/Xsession (downstream)
  • LightDM - /etc/lightdm/Xsession (from Arch folks)
  • LXDM - /etc/lxdm/Xsession

LightDM Xsession

from /etc/lightdm/Xsession (provided by Arch Linux):

# 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

Downstream: Fedora

Little investigation first:

$ dnf provides '*/Xsession'
Last metadata expiration check performed 0:15:37 ago on Sun Sep 13 17:20:31
2015.
sddm-0.10.0-4.fc22.i686 : QML based X11 desktop manager
Repo        : @System

xorg-x11-xinit-1.3.4-8.fc22.i686 : X.Org X11 X Window System xinit startup
scripts
Repo        : @System

gdm-1:3.16.1.1-1.fc22.i686 : The GNOME Display Manager
Repo        : fedora

kde-settings-kdm-22-7.fc22.noarch : Configuration files for kdm
Repo        : fedora

lxdm-0.4.1-9.fc22.i686 : Lightweight X11 Display Manager
Repo        : fedora

sddm-0.10.0-4.fc22.i686 : QML based X11 desktop manager
Repo        : fedora

x2goserver-xsession-4.0.1.19-3.fc22.i686 : X2Go Server Xsession runner
Repo        : fedora

xorg-x11-xdm-1:1.1.11-8.fc22.i686 : X.Org X11 xdm - X Display Manager
Repo        : fedora

xorg-x11-xinit-1.3.4-8.fc22.i686 : X.Org X11 X Window System xinit startup
scripts
Repo        : fedora

gdm-1:3.16.2-1.fc22.i686 : The GNOME Display Manager
Repo        : updates

kde-settings-kdm-22-11.fc22.noarch : Configuration files for kdm
Repo        : updates

So, these are there packages shipping some Xsession script:

  • gdm (patched)
  • kde-settings-kdm (no patch needed, upstream uses fedora default)
  • lxdm (no patch needed, upstream uses fedora default)
  • sddm (reconfigured)
  • x2goserver-xsession (uses own Xsession script)
  • xorg-x11-xdm
  • xorg-x11-xinit

Note there is no lightdm in this list.

After dnf downloading rpm packages listed above, let's see the scripts:

$ ls *.rpm | xargs rpm -ql -p | grep Xsession
/etc/gdm/Xsession                # (ignored, gdm uses xinit/Xsession)
/etc/kde/kdm/Xsession            # (used, but it executes xinit/Xsession)
/etc/lxdm/Xsession               # (used, but it also executes xinit/Xsession!)
/usr/share/sddm/scripts/Xsession # (ignored, sddm uses xinit/Xsession)
/etc/x2go/Xsession               # (used, but executes ~/.xprofile file)
/etc/X11/xdm/Xsession            # link to ../xinit/Xsession
/etc/X11/xinit/Xsession          # fedora default

LightDM

uses xorg-x11-xinit Xsession wrapper:

$ grep /etc/X11/xinit/Xsession *
lightdm-1.10.2-fedora_config.patch:+session-wrapper=/etc/X11/xinit/Xsession

GDM

uses xorg-x11-xinit Xsession wrapper:

$ grep /etc/X11/xinit/Xsession *
gdm.spec:    -e 's@^BaseXsession=/etc/X11/xdm/Xsession@#BaseXsession=/etc/X11/xinit/Xsession@' \
gdm.spec:  /etc/X11/xinit/Xsession

Also, see the changelog:

* Mon Mar  6 2006 Ray Strode <rstrode@redhat.com> - 1:2.13.0.9-3
- migrate users with baseXsession=/etc/X11/gdm/Xsession to
  /etc/X11/xinit/Xsession

KDM (kde-settings)

$ cat ./kde-settings-23-3/etc/kde/kdm/Xsession
#!/bin/sh

for XSESSION in /etc/X11/xinit/Xsession /etc/X11/xdm/Xsession ; do
  test -x $XSESSION && exec $XSESSION ${1+"$@"}
done

echo "/etc/X11/xinit/Xsession and /etc/X11/xdm/Xsession not found."
exit 1

LXDM

Xsession script from upstream executes xorg-x11-xinit Xsession wrapper, see lxdm-0.5.1-D20150806git17ac3772/data/Xsession:

[ -f /etc/xprofile ] && . /etc/xprofile
[ -f ~/.xprofile ] && . ~/.xprofile

if [ -f /etc/X11/xinit/xinitrc-common ]; then
# fedora
    . /etc/X11/xinit/xinitrc-common
    exec -l bash -c "$LXSESSION"
elif [ -x /etc/X11/xinit/Xsession ]; then
# fedora
    exec /etc/X11/xinit/Xsession "$LXSESSION"

Note that it executes ~/.xprofile first. This is a problem, because I can't include the .xprofile file from xinit Xsession script again ...

Ops.

SSDM

uses xorg-x11-xinit Xsession wrapper:

$ grep /etc/X11/xinit/Xsession *
Configuration.h:            Entry(SessionCommand,      QString, _S("/etc/X11/xinit/Xsession"),              _S("Xsession script path\n"
sddm.conf:#SessionCommand=/etc/X11/xinit/Xsession
sddm.spec:  -DSESSION_COMMAND:PATH=/etc/X11/xinit/Xsession \
sddm.spec:- sddm.conf: SessionCommand=/etc/X11/xinit/Xsession

x2goserver-xsession

Uses it's own Xsession file. Btw it executes ~/.xprofile file, see x2goserver-4.0.1.19/x2goserver-xsession/etc/Xsession:

# Load profile
for file in "/etc/profile" "$HOME/.profile" "/etc/xprofile" "$HOME/.xprofile";
do
    if [ -f "$file" ]; then
        echo "Loading profile from $file";
        set +e
        . "$file"
        set -e
    fi
done

But this is not standard DM ...

XDM

uses xorg-x11-xinit Xsession wrapper:

$ grep Xsession -R .
./xorg-x11-xdm.spec:# We want to use the system Xsession script
./xorg-x11-xdm.spec:rm -f $RPM_BUILD_ROOT%{_sysconfdir}/X11/xdm/Xsession
./xorg-x11-xdm.spec:(cd $RPM_BUILD_ROOT%{_sysconfdir}/X11/xdm; ln -sf
../xinit/Xsession .)
./xorg-x11-xdm.spec:%{_sysconfdir}/X11/xdm/Xsession
./xorg-x11-xdm.spec:- Use system Xsession script (bug 244264)

Fedora BZs

https://bugzilla.redhat.com/show_bug.cgi?id=845339

BZ 845339 comment 3 states:

Upstream GDM does support sourcing .xprofile but we don't use the upstream gdm Xsession file. Instead we use the one shipped in xorg-x11-xinit. Reassigning to xorg-x11-xinit.

Debian Bugs

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=438866

Also

This can be ignored (just some descritipion which mentiones xprofile file): https://wiki.ubuntu.com/X/Config/Resolution#By_Session_with_.xprofile

Others: nice summary of swithing to linux from bsd: http://www.daemon.de/blog/2015/06/03/396/xmonad-dell-xps13-developer-edition-ubuntu/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment