OpenBSD used to use X in the usual way. The default install provided the components, the user created their .xinit file and one could easily use startx to work with their preferred environment.
However, as of 6.5, this is no longer the case. For various reasons they have now changed the procedure for using X. Their faq page on X gives a fairly simple explanation but it wasn't clear to me at first.
Note that as of OpenBSD-7.4, the usual startx with a $HOME/.xinitrc file works again. However, I'm leaving this page up, in case it goes back to only working with xenodm again.
During installation, you are asked if you want xenodm to startx with a default of no. Assuming you take the default, once you have logged in as your user, it is easily rectified.
First as root or with doas, you will enable the xenodm display manager using rcctl. In the example, we also start it, but that could wait.
doas rcctl enable xenodm doas rcctl start xenodm |
Rather than an .xinitrc files in your home directory, you will name the file .xsession. It will work the same way as an .xinitrc file.
Those are the only changes you should have to make. Some people prefer to use the .xinitrc and just link it to ~/.xsession but it shouldn't be necessary.
If you only want to run X at times, and otherwise boot into console mode, you can just run
doas rcctl -f start xenodm |
The -f is for force and used when a service isn't enabled. This way, you can usually use console, and use the rcctl -f when you want to have an X session. Once you have logged in, the window manager specified in your ~/.xsession file will open.
You may dislike the defaults. The two things that made it a bit hard to work with) for me were an xconsole in the lower right that just took up space, and the default coloring, which, to my aging eyes, made it hard to see what I was typing.
The xconsole can just be commented out in /etc/X11/xenodm/Xsetup_0. The syntax changes from time to time, but just find a line in there that has xconsole and comment it out. In 7.4 the line to comment reads
${exec_prefix}/bin/xconsole -geometry 480x130-0-0 -daemon -notify -verbose -fn fixed -exitOnFail |
which has to be commented out if you don't want the console in your xsession.
The default colors are in /etc/X11/Xresouces. For me, I don't much care, I just needed to be able to see what I was doing, so I changed the first xlogin*greetColor from its rgbcode to black. I did the same at xlogin*inpColor.
With those two set to black it was quite easy for me to read. I didn't bother with a hex code I just used the word black and all was well. The reader who wishes to further customize can find things all over the web. I havten't tried any of them. as said on The Good Place, I'm basic.
In OpenBSD-7.1, I didn't have to change the colors, I had no problem reading them, so I didn't change defaults.
As mentioned above,tthis changed, but in OpenBSD-7.4, one no longer needs xenodm to run X, a simple startx with an .xinitrc file works again.