KDM .Xsession Workaround

At some point, somebody made the decision that the venerable XDM wasn’t good enough, and so they wrote KDM to replace it. If you’re a longtime survivor of the ongoing X-Windows Disaster, you might be scratching your head about the whole thing; I’m shaking my head about a specific part of it and here’s why.


The way it used to work back in the stone age was that a user would have an .Xsession file, and when you put your name and password into XDM, it would call up your .Xsession file, and that file would fire up a bunch of other stuff, like browsers, terminals, a load monitor or whatever other stuff you wanted to put in there before finally firing up the window manager.

KDM, being both new and improved, does the opposite – now you can choose from a list of different WMs, and there’s no mechanism for firing up anything default at all. Because this is the future, or something. But boy, you sure can make it look pretty. Woo!

KDM doesn’t respect your .xsession file unless you choose “default”, at which time you can go back to running things the old way. There is no mechanism in a standard KDM setup, as far as I can tell, to have it both ways – you either get to choose your window manager and not run any programs, or you can run your .Xsession file. The whole “default” mechanism is more than a little suspect, being both completely counterintuitive (your username is already associated with your previous WM, which is what “default” means to most people) and if you don’t have a valid .Xsession file, outright broken.

Going from “preloaded apps and no WM choice” to “WM choice and no preloads” is clearly not progress, and this is how I’ve fixed this particular idiocy:

  • Take your old .Xsession file, copy it to .Xsession-apps

  • Open .Xsession-apps up and cut out the window manager line.
  • Create a file in /etc/X11/Xsession.d/ called 95xsession-apps_start, and put this in it:


    for STARTAPPS in "$HOME/.Xsession-apps" "$HOME/.xsession-apps" ; do
      if [ -e $STARTAPPS ]; then
        . $STARTAPPS
        break
      fi
    done

  • log out, log back in.

It took me far, far longer to figure out how to set this up than it should have, and I don’t claim that this doesn’t suck, only that it sucks less.

This is only meant for KDM, by the way. It might work on Gnome, and it might not, and I don’t care – Gnome is pretty, but whenever my computer goes bobbing for Objects in the Corba barrel it takes forever to come up for air. When I want that kind of user experience I’ve still got my old Commodore 64 downstairs.

6 Comments

  1. Posted December 15, 2003 at 10:01 am | Permalink

    Of course this is progress! Assuming you realize, of course, that Linux GUIs are for people who are still disappointed that you can’t actually program a computer by flipping front-panel switches any more, and that every UI element is therefore designed to maximize tweaking potential rather than ease-of-use.

    (As for “pretty,” is there really anything prettier than that old moire-inducing black-and-white pattern that I always associate with X?)

  2. Mike Hoye
    Posted December 15, 2003 at 1:46 pm | Permalink

    Have you ever looked at the ICCCM?

    Christ, what a nightmare.

  3. Posted December 18, 2003 at 1:23 pm | Permalink

    You’re doing it wrong.

    If you’re running a desktop environment, you’re supposed to use the facilities there to start programs at the start of the session. It’s why they include session managers. This is intended to woo you away from the traditional unix methods.

    If you want to evaluate a file for a list of programs, it quite reasonably assumes that you’re a traditional Unix Guy, and don’t want to be bothered with the newfangled gui contraptions.

    Assuming kdm is like gdm (I’m not about to install kdm to find out, but I imagine it is), the session choices are essentialy prefab xsession files.

    Kozlowski: your opinions are out of date.

  4. Posted December 18, 2003 at 1:25 pm | Permalink

    There really are paragraphs in what I wrote. Seriously.

  5. Mike Hoye
    Posted December 18, 2003 at 2:13 pm | Permalink

    Well, not all my work is done in “desktop environments”. I spend almost all my time in either an rxvt terminal or Firebird. I can’t figure out any other ways to have both a variety of window-manager choices (I like having both the extremely-lightweight evilwm and the option of using KDE) and having a consistent set of programs load up.

  6. Posted December 18, 2003 at 3:05 pm | Permalink

    Well, you’re weird. Most people pick something and stick with it.

    Plus the xsession file isn’t truly a list of programs to start up. It’s the program that xdm runs to represent an, um, X session. So there’s no sane way for alternate mechanisms to use the file. Consider that you could just make xsession a symlink to your window manager binary.

    They could provide a common .programs (or whatever) idiom, but both of the alternate DMs are written for desktop environments that include session management, which obviates a flat program list or startup script. So the feature would be useless for their target audience and useless for 99% of the old time unix people, most of whom will just use a single .xsession file like they’ve always done.