[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: How to edit .xsession?



Thanks...

On Sun, Nov 20, 2011 at 5:57 AM, Bob Proulx <bob@proulx.com> wrote:
shiyao ma wrote:
> I touched a file .xsession in ~ however, it seems lightdm won't let me
> login if the .xession exists.
> Once I delete .xession, everything becomes normal.
> Then, how to add .xsession properly?

If ~/.xsession exists (my normal case) then the standard system
/etc/X11/Xsession script will handle it one of two ways in
50x11-common_determine-startup.

1. If the file is executable then Xsession will exec it.  This is
  normally what you want.

2. If the file is not executable then Xsession will run 'sh' on it.
  This sometimes confuses people who put bash specific syntax in the
  file but have it run by a POSIX compatible shell.

Two questions:

1. Is your ~/.xsession executable?  If not then it will be run by
  /bin/sh instead of by your choice in the #! line.

2. What are the contents of your ~/.xsession?  It must be a complete
  session startup.  It must at the least start a window manager.

This would be a reasonable minimum size, minimum functionality file
that sources your /etc/profile, ~/.profile (or ~/.bash_profile) files.
The inclusion of '#!/bin/bash --login' places a login shell in the
execution path and therefore loads up your login environment.

 #!/bin/bash --login
 exec x-session-manager

Ensure that it is executable or the '#!/bin/bash --login' part will
have no effect.  This is a very important and often missed part!

 chmod a+x ~/.xsession

Because this starts x-session-manager it will respect the Debian
alternative settings for x-session-manager.

 update-alternatives --display x-session-manager

But it is okay to hard code your own window manager choice there too.
For example by using something very simple such as fvwm, just to
furnish a hard example.

 #!/bin/bash --login
 exec fvwm

Bob



--
My gpg pubring is available via: gpg --keyserver subkeys.pgp.net --recv-keys 307CF736

More on: http://about.me/introom



Reply to: