Changing the default X Window in Linux - startx and .xinitrc
If you use the startx command for starting up the X Window System, you'll need to edit a file called
.xinitrc that is located in your home directory. If the file already is there, just open it with your favorite text editor.
If you don't have such a file in your home directory, create a new file with that name. Note the dot in the file name - it shows you that the file is a hidden file and doesn't show when you do a normal directory listing.
If you already have a
.xinitrc file in your home directory, it may be a huge scary-looking text file with a lot of text that makes just as much sense as a file produced with a random number generator and encrypted after writing. If you want to make a backup of this file, rename it to something like
.xinitrc.backup or whatever you wish:
mv .xinitrc .xinitrc.backup
Now you can use your text editor for creating a new, blank
.xinitrc file. Although the file may be a complicated multi-line geeky script, it can be very simple, too. In its simplest it just contains a single line with the name of your new window manager. So, add a line like this to your file:
exec windowmanager
where windowmanager is the command that starts the window manager you want to be your default. For example, to make Window Maker your default window manager, you'd have a line like this:
exec wmaker
The commands for starting some popular window managers and desktop environments are:
* KDE = startkde
* Gnome = gnome-session
* Blackbox = blackbox
* FVWM = fvwm (or, for FVWM2 it's fvwm2, surprise)
* Window Maker = wmaker
* IceWM = icewm
After editing the
.xinitrc file, save your changes. The next time you do a startx, the new window manager will be your default.