4

I'm running an arch linux system with no window manager or desktop environment (right now). I use tmux when I need multiple terminals. When I run sudo showconsolefont on my tty (no tmux), I see the expected set of symbols, but when I open tmux and run sudo showconsolefont, I see a different set of symbols that repeats itself.

My font is ter-124b, from the Terminus family.

In the screenshot, the top output was captured from within tmux and looks identical to how it was displayed when I ran sudo showconsolefont. The bottom output contains different symbols, but if I redirect it to a file and then cat the file, they look the same. diffing them also reports that they are identical.

Why is the output of showconsolefont different in tmux? I thought the point of that command was to display all available symbols in the current font. Since I'm using the same font inside and outside of tmux, I don't understand why there's any difference. I'm sure there's some simple linux font concept that I'm missing here. Could someone point it out to me?

I tried checking the value of $TERM if I'm in tmux and ensuring that it defaults to linux (the same as $TERM in my tty), but that hasn't made any difference. (set -g default-terminal "linux")

3

short: tmux can't display all 256 items in a font

long:

Refer to the source code, which is a little awkward since (see KBD – Linux keyboard tools webpage) prefers tarballs, but you can use the git-cloning advice to be able to browse the source. The showconsolefont program does this

  • opens the specified device,
  • verifies that it is a console,
  • gets the current mode, to see if it is using UTF-8,
  • makes a dummy (trivial) screen-map
  • gets the current screen-map
  • prints the array...
  • for each row, it remaps the characters in the array to show the font
  • restores the mode and screen-map for the console

The reason why showconsolefont can show 256 items (rather than say 256 - 32 control characters) is because it remaps the codes sent directly to the console. Actually that would be 33 controls because 0x9b is handled differently. Close enough. showconsolefont is writing characters that appear to be printable, but is row-by-row changing the characters which are actually drawn.

One thing that you may notice is that all of the changes to the console device use the file descriptor for the actual device, while the array of characters is written to the standard output. When you run this outside tmux, those are the same device. But running inside tmux, the standard output is to a different device (a pseudo-terminal, which separates the special mapping from the characters. If you redirect the shell to the console, e.g.,

$ tmux
$ sudo su -
# exec >/dev/console
# showconsolefont

you will be able to see part of the interesting characters. But the pseudo-terminal will not show carriage-return/line-feeds as expected, and the status line for tmux may not be drawn properly:

redirecting showconsolefont inside tmux

versus (outside tmux):

ordinary showconsolefont

There might be a way to set root's terminal modes to get readable output, but this is not what showconsolefont or tmux will do without some work.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.