From ArchWiki
Revision as of 15:00, 5 December 2013 by Lonaowna (talk | contribs)
Jump to navigation Jump to search

~/.xprofile and /etc/xprofile allow you to execute commands at the beginning of the X user session, before the Window Manager is started. Therefore it cannot be used to start window-based applications. See Autostarting#Graphical for that.

xprofile is similar to xinitrc (~/.xinitrc and /etc/X11/xinit/xinitrc.d/).


xprofile (and xinitrc) files are natively sourced by

  • GDM (/etc/gdm/Xsession)
  • KDM (/usr/share/config/kdm/Xsession)
  • LightDM (/etc/lightdm/Xsession)
  • LXDM (/etc/lxdm/Xsession)

Making it compatible with xinit

It is possible to make xprofile compatible with these programs:

All of these execute, directly or indirectly, ~/.xinitrc (usually copied from /etc/skel/.xinitrc), or /etc/X11/xinit/xinitrc if it doesn't exist. That's why we have to source xprofile from these files.

~/.xinitrc and /etc/X11/xinit/xinitrc and /etc/skel/.xinitrc

# Make sure this is before the 'exec' command or it won't be sourced.
[ -f /etc/xprofile ] && source /etc/xprofile
[ -f ~/.xprofile ] && source ~/.xprofile


xinitrc.d/* files are already sourced from the default xinitrc file.