getting .xsession to run

Michael Wardle michael at endbracket.net
Sat Aug 20 08:07:49 UTC 2005


On Sat, 2005-08-20 at 00:51 -0600, Luis Murillo wrote:
> I have created the file .xsession in my home dir. When I log in it
> should get executed, or at least that's what it did in the other distros
> I was using. But it only gets executed when I run the command startx
> from a console.
> Was GDM modified to disable the execution of .xsession? How can I enable
> this?

It looks like lol has already answered your question, but I thought I'd
give some background.

Your Xsession file is intended as your own custom initialization script
for an entire X session.  In other words, it replaces your system's
startup script.

My .xsession looks like:
----------
# start the first desktop environment found on this system
type gnome-session && exec gnome-session
type startkde && exec startkde
...
# fall back to just an xterm
xterm
----------

If you follow GDM's configuration in /etc/gdm/gdm.conf, you will go
thru /etc/gdm/Xsession, which is called with the arguments contained in
the appropriate session you selected in the GDM Sessions menu.

For example, the "Default System Session" is defined
in /usr/share/gdm/BuiltInSessions/default.desktop.  It runs
"/etc/gdm/Xsession default", which in turn reads in some configuration
then tries to run "exec ~/.xsession" (which should be executable for
best results).

Compare this to the "GNOME" item, defined
in /usr/share/xsessions/gnome.desktop, which runs
"/etc/gdm/Xsession /usr/bin/gnome-session", which in turn reads in some
configuration then runs "exec /usr/bin/gnome-session", completely
bypassing your ~/.xsession.

If you want to have certain programs automatically start when your GNOME
session does, the recommended way is to add programs using the System ->
Preferences -> Sessions menu.

Some people also prefer to use a startup script called .xclients to have
some standard applications start irrespective of the desktop environment
used.  If they're non-graphical programs, you can place them in .profile
for all login sessions, since GDM now reads them in when you start your
session.  If they're graphical, you might need to add a script
to /etc/X11/Xsession.d that sources .xclients or a script of your
choice.






More information about the ubuntu-users mailing list