I have xorg and xinit and I want to start some commands before the X environment. I did this many times and idk bc doesn't work.

I made a touch ~/.xprofile and here I wrote the command that I want to run before the X enviroment, the .xprofile file has execution permision and has the comment #!/bin/bash above of all the commands (I only have 1 command because I am trying) but reading in the arch wiki, this should work.

The permisions of the file:

-rwxr--r-- 1 root root 28 nov  1 20:04 /root/.xprofile

and the file

setxkbmap es &

1 Answer 1


You may need add below lines before exec in your .xinitrc file. Otherwise, the .xprofile won't work at all.

# This line try to import /etc/xprofile if it exists
[ -f /etc/xprofile ] && . /etc/xprofile
# As ditto
[ -f ~/.xprofile ] && . ~/.xprofile

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .