How to make startx use alternate xinitrc?

11,000

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.

Share:
11,000

Related videos on Youtube

phunehehe
Author by

phunehehe

Updated on September 17, 2022

Comments

  • phunehehe
    phunehehe almost 2 years

    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?

  • phunehehe
    phunehehe over 13 years
    The file name thing is weird, anyway this answer works for me, thanks!
  • Leo
    Leo about 5 years
    In my case the path must be absolute. The relative paths not work.