Difference between revisions of "Xprofile"

From ArchWiki
Jump to: navigation, search
(.xprofile not being sourced with (at least gdm on gnome) on a wayland session, so I added the correct way accoding to https://wiki.gnome.org/Initiatives/Wayland/SessionStart)
(Undo revision 525871 by Matse (talk) - wayland does not use an "X session" so this is clear from the first sentence; recommendations for wayland are unsutable here)
Line 10: Line 10:
  
 
An xprofile file, {{ic|~/.xprofile}} and {{ic|/etc/xprofile}}, allows you to execute commands at the beginning of the X user session - before the [[window manager]] is started.
 
An xprofile file, {{ic|~/.xprofile}} and {{ic|/etc/xprofile}}, allows you to execute commands at the beginning of the X user session - before the [[window manager]] is started.
 
If you are using a Wayland session, xprofile is not sourced and you should rely on [[Systemd/User#Environment_variables | Systemd Environment variables]].
 
  
 
The xprofile file is similar in style to [[xinitrc]].
 
The xprofile file is similar in style to [[xinitrc]].

Revision as of 12:46, 14 June 2018

An xprofile file, ~/.xprofile and /etc/xprofile, allows you to execute commands at the beginning of the X user session - before the window manager is started.

The xprofile file is similar in style to xinitrc.

Compatibility

The xprofile files are natively sourced by the following display managers:

  • GDM - /etc/gdm/Xsession
  • KDM - /usr/share/config/kdm/Xsession
  • LightDM - /etc/lightdm/Xsession
  • LXDM - /etc/lxdm/Xsession
  • SDDM - /usr/share/sddm/scripts/Xsession

Sourcing xprofile from a session started with xinit

It is possible to source xprofile from a session started with one of the following programs:

All of these execute, directly or indirectly, ~/.xinitrc or /etc/X11/xinit/xinitrc if it does not exist. That is why xprofile has to be sourced from these files.

~/.xinitrc and /etc/X11/xinit/xinitrc
#!/bin/sh

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

...

Configuration

Firstly, create the file ~/.xprofile if it does not exist already. Then, simply add the commands for the programs you wish to start with the session. See below:

~/.xprofile
tint2 &
nm-applet &