# My xenodm setup OpenBSD uses the [`xenodm(1)`](https://man.openbsd.org/xenodm) display manager, which is a fork of xdm. Xenodm looks quite ugly by default, and after reading a couple[^1] of[^2] articles[^3] on themeing xenodm I've come up with my own setup. Before we get into the configs, here's what it actually looks like: [![themed xenodm](/static/img/xenodm.png)](/static/img/xenodm.png) _(The text might be small, click to view the image file)_ Clean and simple. Now that you've seen what it looks like you can close this tab if that's all you came here to see. If you want to see how this is accomplished then continue reading. ## Files xenodm uses multiple files for configuration. It's quite inconvenient, and I was very confused at first I admit. The files we'll have to deal with are: ``` /etc/X11/xenodm/Xresources /etc/X11/xenodm/Xsetup_0 /etc/X11/xenodm/Xsession ``` The last one is for an optional non-cosmetic change that I'll cover later. All these files require root access, so it'd be wise to `doas -s` before continuing on. ## Xresources If you've ever dabbled in trying to rice your Unix-like operating system there's a good change you've come across an [Xresources](https://wikipedia.org/wiki/X_resources) file before. The X window system uses a "resource database" as a 'unified' way to store configuration data. xenodm sources the Xresources file before loading. Using entries in the Xresources file we can configure what the login widget (the place we type our username + password) looks like. First off, I'd like to be able to see my password being entered as I type with little `*` as it so commonly is. ``` xlogin.Login.echoPasswd: true ``` Next I don't want to be 'greeted', and I want the message when I put my password in incorrectly to be `ya dun goofed`: ``` xlogin.Login.fail: ya dun goofed xlogin.Login.greeting: ``` Now I'll configure the dimensions and positioning of the login box: ``` xlogin.Login.height: 200 xlogin.Login.width: 400 xlogin.Login.y: 320 xlogin.Login.frameWidth: 10 xlogin.Login.innerFramesWidth: 0 ``` Add some colour (or lack thereof): ``` xlogin.Login.background: #000000 xlogin.Login.foreground: #eeeeee xlogin.Login.failColor: #b00035 xlogin.Login.inpColor: #000000 xlogin.Login.promptColor: #eeeeee xlogin.Login.hiColor: #000000 xlogin.Login.shdColor: #000000 ``` And finally let's use a nice bitmap font to complete the look: ``` xlogin.Login.face: Dina-11 xlogin.Login.failFace: Dina-11 xlogin.Login.promptFace: Dina-11 ``` Note that last step requires the Dina font to be installed (it does not come with OpenBSD). ## Xsetup_0 Next is the Xsetup file. Why is this called Xsetup_*0*? Because xenodm can be configured to run multiple X display servers, and the main one is 0, hence the 0 (check out `/etc/X11/xenodm/xenodm-config`). This file is fairly simple. It's a shell script that xenodm runs. That's it. Simple as that. Through this script we can run pretty much any program we like. In my case, a simple lemonbar script:
/etc/X11/xenodm/Xsetup_0:
``` #!/bin/sh # set background /usr/X11R6/bin/xsetroot -solid \#000000 # add Dina font to font list /usr/X11R6/bin/xset fp+ /usr/local/share/font/dina # status bar ( while true; do reboot="%{F#b00035}%{A:reboot:} r %{A}%{F-}" shutdown="%{F#b00035}%{A:shutdown -p now:} p %{A}%{F-}" echo " $(date '+%T') %{r}${reboot}/${shutdown} $(date '+%F') $(apm -l)% " sleep 1 done | /home/zzz/bin/lemonbar -d -g 1920x40+0+0 -f 'Dina:style=Medium:pixelsize=13' -B \#000000 -F \#eeeeee | sh ) & # uncomment to take 'screenshot' #(sleep 5 && xwd -out /tmp/xenodm.xwd -root) & ``` The date, time, battery percent are all piped into lemonbar. Additionally the 'r' and 'p' text in red allow me to reboot or power off my machine respectively. It should be noted that I probably shouldn't be using a binary that's located in my user writable home directory here. Check the footnotes for other options, namely using xmessage and/or xclock. Or you can just take out the lemonbar bit entirely, which I will likely do in the future. ## Xsession extra Here's the optional bit. I'm a big fan of [decluttering](https://github.com/vizs/declutter-home) my home directory. Moving as many dotfiles out of `$HOME/` as possible. Moving `~/.Xresources` was easy - just source a different file from `~/.xsession`. But an annoyance is `~/.xsession` itself, which up until now I had no idea how to move. Turns out its location can be changed in `/etc/X11/xenodm/Xsession`! Look for the line that says: ``` startup=$HOME/.xsession ``` Here we can change the `startup` variable to be any path we like: ``` startup=${HOME}/etc/x/xsession ``` Also, if you've themed [`ssh-askpass(1)`](https://man.openbsd.org/ssh-askpass) like I have and want to actually see those changes when it prompts for your ssh key password then you should probably source your user Xresources before running all the ssh-related stuff. Look for this part of the script: ``` # if we have private ssh key(s), start ssh-agent and add the key(s) id1=$HOME/.ssh/identity id2=$HOME/.ssh/id_dsa id3=$HOME/.ssh/id_rsa id4=$HOME/.ssh/id_ecdsa id5=$HOME/.ssh/id_ed25519 if [ -z "$SSH_AGENT_PID" ]; then if [ -x /usr/bin/ssh-agent ] && [ -f $id1 -o -f $id2 -o -f $id3 -o -f $id4 -o -f $id5 ]; then eval `ssh-agent -s` ssh-add < /dev/null fi fi ``` Just anywhere above this section simply add `xrdb -load $HOME/path/to/xresources`. [^1]: https://www.tumfatig.net/20190208/customizing-openbsd-xenodm/ this is the first article I read on the subject [^2]: https://www.vincentdelft.be/post/post_20190720 [^3]: https://www.romanzolotarev.com/openbsd/xenodm.html this article is the basis for my configuration, stylistically and config-wise.