How can I use LightDM for user-defined sessions?
If I unterstand it correctly, LightDM has replaced GDM per default. I wonder if it's possible to make it run the things I put in my .xinitrc file ... what I need is an option below "Unity" and "Unity 2D" which says "Run a user-defined session".
Is that possible? Should be the easiest thing, but I did not get a clue so far. I export and define and run a lot of things in this file, so it's pretty important for me to have control over that.
What I do NOT want is a custom session in /usr/some/where, I only want it to run the stuff from each user's xinitrc (or similar).
Solution 1:
Create a new file /usr/share/xsessions/custom.desktop
with:
[Desktop Entry]
Name=Xsession
Exec=/etc/X11/Xsession
You should now have a new session option during login, Xsession will load the user's ~/.xinitrc
.
Solution 2:
Create a new file /usr/share/xsessions/default.desktop
(The name is up to you, but it has to have .desktop
suffix):
[Desktop Entry]
Name=Default
Comment=This runs user session and logs you into Ubuntu
Exec=default
Icon=
Now when you select this session in lightdm
and log in, your ~/.xsession
file, if exists, will be executed.
Note that the user's file that is executed is ~/.xsession
, and not ~/.xinitrc
, which was mentioned in the question. (~/.xinitrc
is used when the X session is started using the startx
script from a command line.)
Some explanations:
The Name
entry is what lightdm
would display for this session. The Exec
entry is the important thing, and it should be the name of the program that starts the actual session. When you log in, lightdm
calls the /etc/X11/Xsession
script, passing it the value of Exec
as an argument, and Xsession
will, eventually, execute this program (for example, it could be startxfce4
for starting a xfce4
session).
If the Exec
entry is the special string default
, then Xsession
will execute the user's ~/.xsession
file. (Xsession
would also execute ~/.xsession
if it's called without aruments.)
Sorry, I'm new here and hence cannot comment on other people's answers, but I'd like to comment on the accepted answer, to make things clearer. As per my explanation above, what will happen with that answer's method is that Xsession
would be called by lightdm
with an argument which is (the full path of) Xsession
. So Xession
will run and then call itself, this time with no arguments. The second Xsession
, being called with no arguments, will execute the user's ~/.xsession
. So the desired action will, eventually, be taken, but in a bit awkward way.
Solution 3:
To use olvwm:
1) Type sudo apt-get install olvwm
in a console
2) Create this session :
/usr/share/xsessions/olvwm.desktop
[Desktop Entry]
Name=Open Look
Exec=olvwm
Type=Application