Difference between revisions of "Xprofile"

From ArchWiki
Jump to: navigation, search
(Making it compatible with xinit: fixed small mistake in code comment (executed -Y)
(add info about the /etc/X11/xinit/xinitrc.d/ folder)
Line 5: Line 5:
  
 
{{ic|/etc/xprofile}} and {{ic|~/.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.
 
{{ic|/etc/xprofile}} and {{ic|~/.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.
 +
 +
The {{ic|/etc/X11/xinit/xinitrc.d/}} folder is also a place for the same purpose. Users can place individual bash script files that will be executed in alphabetical order.
  
 
== Compatibility ==
 
== Compatibility ==
  
xprofiles are natively sourced by [[KDM]] ({{ic|/usr/share/config/kdm/Xsession}}), [[GDM]] ({{ic|/etc/gdm/Xsession}}) and [[LXDM]] ({{ic|/etc/lxdm/Xsession}}).
+
xprofile and xinitrc.d/* files are natively sourced by
 +
* [[GDM]] ({{ic|/etc/gdm/Xsession}})
 +
* [[KDM]] ({{ic|/usr/share/config/kdm/Xsession}})
 +
* [[LightDM]] ({{ic|/etc/lightdm/Xsession}})
 +
* [[LXDM]] ({{ic|/etc/lxdm/Xsession}})
  
 
=== Making it compatible with xinit ===
 
=== Making it compatible with xinit ===
  
It is possible to make xprofiles compatible with these programs:
+
It is possible to make xprofile compatible with these programs:
 
* {{Ic|startx}}
 
* {{Ic|startx}}
 
* {{Ic|xinit}}
 
* {{Ic|xinit}}
Line 19: Line 25:
 
* any other [[Display Manager]] who uses {{ic|~/.xsession}} or {{ic|~/.xinitrc}}
 
* any other [[Display Manager]] who uses {{ic|~/.xsession}} or {{ic|~/.xinitrc}}
  
All of these execute, directly or indirectly, {{ic|~/.[[xinitrc]]}} (usually copied from {{ic|/etc/skel/.xinitrc}}), or {{ic|/etc/X11/xinit/xinitrc}} if it doesn't exist. That's why we have to source xprofiles from these files.
+
All of these execute, directly or indirectly, {{ic|~/.[[xinitrc]]}} (usually copied from {{ic|/etc/skel/.xinitrc}}), or {{ic|/etc/X11/xinit/xinitrc}} if it doesn't exist. That's why we have to source xprofile from these files.
  
 
{{hc|~/.xinitrc and /etc/X11/xinit/xinitrc and /etc/skel/.xinitrc|
 
{{hc|~/.xinitrc and /etc/X11/xinit/xinitrc and /etc/skel/.xinitrc|
Line 30: Line 36:
 
...
 
...
 
}}
 
}}
 +
 +
xinitrc.d/* files are already sourced from the default xinitrc file.

Revision as of 14:08, 22 November 2013

/etc/xprofile and ~/.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.

The /etc/X11/xinit/xinitrc.d/ folder is also a place for the same purpose. Users can place individual bash script files that will be executed in alphabetical order.

Compatibility

xprofile and xinitrc.d/* 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
#!/bin/sh

# 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.