Creating a new .xinitrc file or edit an existing one? Which is best?

smooth_buddha

Active Member
Joined
Feb 13, 2020
Messages
362
Reaction score
244
Credits
1,648
I just recently indtalled Arch and ive seen 2 different ways to start a desktop enviroment from the .xinitrc file. Im currently using xfce4 for my desktop enviro.

The 2 methods:

1. Create a new .xinitrc file by touch comand and using nano edit it and type

Exec xfce4-session


2. Cp /etc/X11/xinit/.xinitrc /home/user

And edit this copy of the pre exisitng .xinitrc file by delting last fe lines and replacing with

Exec xfce4-session


Both methods seem to work but which is best?
 


f33dm3bits

Gold Member
Gold Supporter
Joined
Dec 11, 2019
Messages
4,619
Reaction score
3,325
Credits
33,517
Option 2 since you are doing it for your user it it's better to use your user's configuration files, if you were wanting several users to start a specific desktop environment it would be more logical to use the one for general use or to use a display manager.
1. pacman -S xorg-xinit
2. cp /etc/X11/xinit/xinitrc /home/user/.xinitrc
3. You can then remove these lines from /home/user/.xinitrc
Code:
twm &
xclock -geometry 50x50-1+1 &
xterm -geometry 80x50+494+51 &
xterm -geometry 80x20+494-0 &
4. Add the desktop environment you want to start to the bottom of /home/user/.xinitrc
Code:
exec startxfce4
5. Add the following to your /home/user/.bashrc
Code:
if [ -z $DISPLAY ] && [ "$(tty)" = "/dev/tty1" ]
then
    startx
fi
 
Last edited:
$100 Digital Ocean Credit
Get a free VM to test out Linux!


Top