Skip to main content

Green terminal theme on OpenBSD

Inspired by a recent post on Reddit where someone created an amber monochrome theme on OpenBSD running CWM I decided to undertake a similar venture to do a green-on-black theme for CWM on OpenBSD.

Terminal font

First, I wanted a font that looked a bit more like the classic terminal fonts I remembered from the 80s so I found DOS terminal font (direct link) which provides classic VGA fonts.

To install them, first I needed to install unzip with doas pkg_add unzip to uncompress them. Next, create the font directory where X will pick up the new fonts mkdir -p ~/.local/share/fonts/ dump the fonts there, and instruct X to pick up the new fonts:

$ ftp -o dos_fonts.zip https://dl.dafont.com/dl/?f=perfect_dos_vga_437
$ unzip dos_fonts.zip
$ fc-cache -f

Then I configured my ~/.Xdefaults to use green-on-black and my custom VGA font just about everywhere. It also sets a few other preferences like how much scrollback an xterm stores, where it appears by default, and whether the scrollbar is visible.

$ cat ~/.Xdefaults
*Background: black
*Foreground: #00c000
*HiBackColor: green
*HiForeColor: black
*faceName: Perfect DOS VGA 437:size=10
*font: Perfect DOS VGA 437:size=10
XTerm*loginShell:true
XTerm*saveLines: 5000
XTerm*geometry: 80x25-0+0
XTerm*scrollBar: false

Next, I configured my ~/.xinitrc to set either my black wireframe image of Puffy as the background or set it to solid black if feh isn't installed. I usually link ~/.xinitrc and ~/.xsession so that it works whether I launch it from xdm/xenodm or by using startx on the command-line.

$ cat ~/.xinitrc
xrdb -m $HOME/.Xdefaults
#disable the beeper
xset b off
# set the background
feh --bg-fill puffy.png || xsetroot -solid black
# start a few apps
xconsole -geometry +0-0 &
xterm &
# launch cwm
exec cwm

Finally, for the window manager trappings, I set my colors to various greens and blacks.

$ cat ~/.cwmrc
sticky yes
borderwidth 1
# border colors
color activeborder green
color inactiveborder darkgreen
color urgencyborder green
# menu colors
color menubg black
color font green
color menufg green
color selfont black

Restarting my X session brought everything up in a delightful green-on-black that looked a little something like this screenshot.

Configuring xenodm

Now, it's nice if your personal X session is green-on-black, but what if you want the xenodm login to also display green-on-black? Well, we can do that too. Before starting, I like to take snapshots of the files I'm editing in case I hose them:

# cd /etc/X11/xenodm/
# mkdir RCS
# ci -l Xresources
# ci -l Xsetup_0

First, all the foreground and background colors in /etc/X11/xenodm/Xresources should be tweaked for various shades of green. Some parts of the file allowed setting the color based on the display's bits-per-pixel, so for high color-depth, I chose more nuanced colors, while for the lower color-depth, I stuck to darkgreen and green. While in there, you can also change the logoFileName properties to point to the green-on-black wireframe image of Puffy if you have one.

Then, in Xsetup_0 above the line that launches xconsole I like to specify xsetroot -solid black to get a black background as well.