I don't have a desktop manager installed (and I don't want to). After logging in through the terminal I use startx to start the GUI. I have entries in ~/.xinitrc for my GUI sessions. Right now I have xmonad in there, but sometimes I want to run a GNOME session, and sometimes a KDE session. I used to edit ~/.xinitrc for that purpose, but I think there should be a more elegant way (something like using alternate configurations). However, I can't find anything in man startx or man xinit.

I plan to have several configuration files (one for each GUI session), and then tell startx to load them when I want. How can I do that?


According to the xinit man page that I read, xinit (and thereby startx) looks in its command line parameters for a client program to run. If it doesn't find one, it runs ~/.xinitrc instead. So you should be able to write

startx path/to/my_alternate_xinitrc

and it will do what you want. You will need to provide a path, though, and not just a filename. In my testing, startx ./my_xinitrc worked but startx my_xinitrc did not.

  • The file name thing is weird, anyway this answer works for me, thanks! – phunehehe Jan 23 '11 at 12:08
  • In my case the path must be absolute. The relative paths not work. – Chad May 9 at 1:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.