15

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?

Gilles 'SO- stop being evil'
  • 807,993
  • 194
  • 1,674
  • 2,175
phunehehe
  • 20,030
  • 27
  • 99
  • 151

1 Answers1

18

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.

Jander
  • 16,272
  • 6
  • 50
  • 66