Making the NetBSD TTY more usable

[home]

The Problem

So I use NetBSD on a Dell Optiplex XE2 without a GUI as a sort of server, I do not need a GUI for this machine so I will either use SSH to use this machine or use the TTY connected to a monitor. The problem is that by default the NetBSD TTY is quite bad, slow refresh rate, bad font, caps lock is not escape etc.


Changing The Font

The default TTY font on NetBSD is quite large and ugly, to change this we need to edit some entries in /etc/wscons.conf. We first need to define the font we want to use, to see the available fonts on your system look in the directory /usr/share/wscons/fonts/. I am going to be using the spleen font specifically the 12x24 variant as it is a nice font and a nice size, this is the font that comes stock on the OpenBSD TTY. Once you have decided which font you are going to use we need to define it in /etc/wscons.conf as follows:

font spleen 12 24 iso /usr/share/wscons/fonts/spleen-12x24.fnt

Change spleen to whatever font name you desire, it is a variable essentially, change the path to whichever font you want to use. Now we have defined our font we need to tell wscons to load the font at boot time as follows:

setvar ttyE0 font spleen
setvar ttyE1 font spleen
setvar ttyE2 font spleen
setvar ttyE3 font spleen

Now on the next boot, you should see your new font displayed.

Swapping Caps Lock And Escape

The process is quite simple, it's just hard to find information on how to do this hence why I am writing this article.
The first step is to echo your current key map into a file in /usr/share/wscons/keymaps/. It's as simple as running this command as root:

wsconsctl map > /usr/share/wscons/keymaps/my_map

This will dump your entire current key map into a file, we do not need all of the text in the file so we will want to delete all un-needed lines. Since all we are aiming to do is swap escape and caps lock just delete all the lines execpt for Caps Lock and Escape and then swap the numbers around so the final product should be somthing like this:

keycode 56 = Cmd_Debugger Escape
keycode 1 = Caps_Lock

This is the what my file looks like. Next we need to tell wscons to load the keymap at boot time, we do this by editing the file /etc/wscons.conf, add the line:

mapfile /usr/share/wscons/keymaps/my_map

Changing my_map to the name of your file and then reboot, now the keys should be swapped around, of course you can use this method to swap any keys that you desire. This method may also work on OpenBSD.

Making The TTY Smoother

The TTY is quite slow by default on NetBSD, and other *BSD's to be honest, this is due to the keyboard refresh rate. We can change the keyboard refresh rate in /etc/wscons.conf, there should be commented out lines at the bottom of the file by default detailing this, I tried using this config and it was too fast for me so I added these lines in the file:

setvar wskbd repeat.del1 400
setvar wskbd repeat.deln 40

This setting is fast enough for the TTY to scroll smoothly and not fast enough that just holding down a key for a second will make that character pprint about 50 times.