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 SDDM to list of DMs supporting Xprofile)
 
(30 intermediate revisions by 10 users not shown)
Line 1: Line 1:
 
{{Lowercase title}}
 
{{Lowercase title}}
[[Category:X Server]]
+
[[Category:X server]]
 
[[es:Xprofile]]
 
[[es:Xprofile]]
 
[[ja:Xprofile]]
 
[[ja:Xprofile]]
 +
[[ru:Xprofile]]
 +
[[zh-CN:Xprofile]]
 +
{{Related articles start}}
 +
{{Related|xinitrc}}
 +
{{Related articles end}}
  
{{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.
+
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.
 +
 
 +
The xprofile file is similar in style to [[xinitrc]].
  
 
== 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}}).
+
The xprofile files are natively sourced by the following display managers:
 +
* [[GDM]] - {{ic|/etc/gdm/Xsession}}
 +
* [[KDM]] - {{ic|/usr/share/config/kdm/Xsession}}
 +
* [[LightDM]] - {{ic|/etc/lightdm/Xsession}}
 +
* [[LXDM]] - {{ic|/etc/lxdm/Xsession}}
 +
* [[SDDM]] - {{ic|/usr/share/sddm/scripts/Xsession}}
  
=== Making it compatible with xinit ===
+
=== Sourcing xprofile from a session started with xinit ===
  
It is possible to make xprofiles compatible with these programs:
+
It is possible to source xprofile from a session started with one of the following programs:
* {{Ic|startx}}
+
* {{ic|startx}}
* {{Ic|xinit}}
+
* {{ic|xinit}}
 
* [[XDM]]
 
* [[XDM]]
 
* [[SLiM]]
 
* [[SLiM]]
* any other [[Display Manager]] who uses {{ic|~/.xsession}} or {{ic|~/.xinitrc}}
+
* Any other [[Display manager]] which 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}} or {{ic|/etc/X11/xinit/xinitrc}} if it does not exist. That is why xprofile has to be sourced from these files.
  
{{hc|~/.xinitrc and /etc/X11/xinit/xinitrc and /etc/skel/.xinitrc|
+
{{hc|~/.xinitrc and /etc/X11/xinit/xinitrc|
 
#!/bin/sh
 
#!/bin/sh
  
Line 29: Line 41:
  
 
...
 
...
 +
}}
 +
 +
== Configuration ==
 +
 +
Firstly, create the file {{ic|~/.xprofile}} if it does not exist already. Then, simply add the commands for the programs you wish to start with the session. See below:
 +
{{hc|~/.xprofile|
 +
tint2 &
 +
nm-applet &
 
}}
 
}}

Latest revision as of 13:30, 11 February 2016

Related articles

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 ] && source /etc/xprofile
[ -f ~/.xprofile ] && source ~/.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 &