Whenever running a terminal, alacritty is my main driver. Recently, I’ve been dabbling with FreeBSD and ran into some curious output when SSHing into a server:

1
2
No entry for terminal type "alacritty";
using dumb terminal settings.

It turns out FreeBSD doesn’t have a definition for alacritty’s terminal capabilities by default and we have to put that in place. Alacritty defines an alacritty.info file that specifies its terminal capabilities. While FreeBSD doesn’t have support for terminfo, it does have support for termcap. As such, we can’t make direct use of the alacritty.info; we have to convert it into a termcap entry.

First, let’s fetch the alacritty.info file:

1
curl -sSL https://raw.githubusercontent.com/alacritty/alacritty/master/extra/alacritty.info -o alacritty.info

Next, we can make use of infotocap to convert to termcap capability entries and append the output into the system termcap file:

1
infotocap alacritty.info >> /usr/share/misc/termcap

There’s a couple things worth noting. First, not everything can translate from terminfo to termcap so you’ll see some “unknown capability” lines output as part of this (the output is truncated for brevity):

1
2
3
"alacritty.info", line 17, col 8, terminal 'alacritty-direct': unknown capability 'RGB'
"alacritty.info", line 27, col 43, terminal 'alacritty+common': unknown capability 'AX'
"alacritty.info", line 27, col 47, terminal 'alacritty+common': unknown capability 'XT'

Second, if you take a peek at the entry we appended to /usr/share/misc/termcap, you’ll notice that some of the capabilities are truncated to deal with sizing restrictions — each termcap entry must be <1024 bytes:

# (untranslatable capabilities removed to fit entry within 1023 bytes)
# (sgr removed to fit entry within 1023 bytes)
# (acsc removed to fit entry within 1023 bytes)
# (terminfo-only capabilities suppressed to fit entry within 1023 bytes)
alacritty+common|base fragment for alacritty:\
        :am:bs:hs:km:mi:ms:xn:\
        :co#80:it#8:li#24:\
        :AL=\E[%dL:DC=\E[%dP:DL=\E[%dM:DO=\E[%dB:IC=\E[%d@:\
        :K2=\EOE:LE=\E[%dD:RI=\E[%dC:SF=\E[%dS:SR=\E[%dT:\
        :UP=\E[%dA:ae=\E(B:al=\E[L:as=\E(0:bl=^G:bt=\E[Z:cd=\E[J:\
        :ce=\E[K:cl=\E[H\E[2J:cm=\E[%i%d;%dH:cr=\r:\
        :cs=\E[%i%d;%dr:ct=\E[3g:dc=\E[P:dl=\E[M:do=\n:\
        :ds=\E]2;\007:ec=\E[%dX:ei=\E[4l:fs=^G:ho=\E[H:im=\E[4h:\
        :is=\E[!p\E[?3;4l\E[4l\E>:k1=\EOP:k2=\EOQ:k3=\EOR:\
        :k4=\EOS:k5=\E[15~:k6=\E[17~:k7=\E[18~:k8=\E[19~:\
        :k9=\E[20~:kD=\E[3~:kI=\E[2~:kN=\E[6~:kP=\E[5~:kb=\177:\
        :kd=\EOB:ke=\E[?1l\E>:kh=\EOH:kl=\EOD:kr=\EOC:\
        :ks=\E[?1h\E=:ku=\EOA:le=^H:md=\E[1m:me=\E[0m:mh=\E[2m:\
        :mm=\E[?1034h:mo=\E[?1034l:mr=\E[7m:nd=\E[C:rc=\E8:sc=\E7:\
        :se=\E[27m:sf=\n:so=\E[7m:sr=\EM:st=\EH:ta=^I:\
        :te=\E[?1049l\E[23;0;0t:ti=\E[?1049h\E[22;0;0t:\
        :ts=\E]2;:ue=\E[24m:up=\E[A:us=\E[4m:vb=\E[?5h\E[?5l:\
        :ve=\E[?12l\E[?25h:vi=\E[?25l:vs=\E[?12;25h:

Now that we’ve got the entries appended, we can compile the database and make alacritty terminal capabilities available when we login:

1
cap_mkdb /usr/share/misc/termcap

No more dumb terminal!

TL;DR

1
2
3
4
curl -sSL https://raw.githubusercontent.com/alacritty/alacritty/master/extra/alacritty.info -o alacritty.info
infotocap alacritty.info >> /usr/share/misc/termcap
cap_mkdb /usr/share/misc/termcap
rm alacritty.info