How do xsession, xinitrc and .i3/config play together?
There are three different ways of starting programs after logging in: ~/.xsession
, ~/.xinitrc
and ~/.i3/config
(or the path to your i3 config file). What’s the difference?
There are three different ways of starting programs after logging in: ~/.xsession
, ~/.xinitrc
and ~/.i3/config
(or the path to your i3 config file). What’s the difference?
Michael has already explained the difference, but I'd like to add a few notes of background (IMHO, it's good to understand how things work step by step):
Based on The X Window User HOWTO:
Given that, you may like to maintain single version of your personal startup script for X:
Make symbolic link for xdm equivalent:
$ ln -s $HOME/.xinitrc $HOME/.xsession
Also, Fluxbox manual includes an important explanation too:
When X11 is started, your .xinitrc or .xsession script is run, and when the script is done, X11 comes down. Let me repeat that, its important: when .xinitrc is finished, that is when X ends. It isn't when your window manager exits.*
You have to differentiate between what gets started after you log in but before you start i3:
~/.xsession
is the way to go when using a login manager (like gdm, kdm, xdm).~/.xinitrc
will be used when you use startxThe i3 configuration (usually ~/.i3/config
) will of course be used in either case, additionally.
So, where should you put your auto-start entries?
`~/.xession` seems to be ignored with GDM on Ubuntu 12.04. I tried to define an environment variable with `export FOO=bar` in a newly created `.xession` (there was none), and `echo $FOO` from a terminal displays nothing, which suggests this file is not sourced.
Asked: 2012-06-04 15:56:48 +0000
Seen: 10,188 times
Last updated: Jun 07 '12
Also see this related question: [Session's environment variables](https://faq.i3wm.org/question/4126/sessions-environment-variables/).