home about
blog 2003 2004 2005 2006 2007 2008 2017 2018 2019 2020
tech android linux vim

16: Linux: console font size and rotation tips

2018-11-16 13:23

Tags: linux tip devuan tty wm i3wm Location: home

I just sat down and figured out how to force my favourite Linux environment to work more sanely on a flat panel display capable of being rotated.

Since the display is old and has no sensors in it to help determine when it should "rotate" my orientation (if that's even a thing outside of tablets?), I was doing it manually in i3-wm. It didn't make for very pleasant use when not in a window manager, however, as the console was always 90 degrees off from readable!

Rotate framebuffer with fbcon

This part is relatively straightforward. Depending on which direction you wish to rotate your display, do one of the following to test it (note that being in a text console (NOT a window manager or desktop environment) will make this a whole lot less frustrating):

	echo X | sudo tee /sys/class/graphics/fbcon/rotate

where "X" is one of:

	0 - no rotation
	1 - clock-wise (90 degree turn), or right rotation
	2 - upside down
	3 - counter-clockwise (-90 degree turn), or left rotation

If this works, add the following to your /etc/default/grub (on Devuan/Debian/Ubuntu), or other grub.conf location should you be on another distro:


again, where "X" is the number for the type of rotation you desire.

Don't forget, of course, to update grub before restarting, otherwise your changes won't do much:

	sudo update-grub2

Rotate window manager on start

Some window managers aren't capable of remembering how they were last oriented, as they may let xrandr do that for them. I use i3-wm, and used to use a keyboard shortcut to rotate it manually on each start up. That got tiresome, and since I had figured out how to do the above, it seemed only natural that I fix this other annoyance.

To do this, I simply added the command I had been using in my i3-wm config to rotate it, to my ~/.xinitrc file.

Here's the snippet from ~/.i3/config, to give you an idea:

	##  Screen rotation shortcuts by system
	##  psu
	bindsym $mod+Shift+Insert exec --no-startup-id "/usr/bin/xrandr --output VGA-1 --rotate normal --mode 1280x1024 --rate 75.02"
	bindsym $mod+Shift+Delete exec --no-startup-id "/usr/bin/xrandr --output VGA-1 --rotate left --mode 1280x1024 --rate 75.02"

I rewrote it without the i3-wm-specific stuff, for my .xinitrc file, and added it near the bottom, but above my window manager:

	##  Turn off screen-blanking
	xset s off
	##  Set up input customisations
	xrdb -merge ~/.Xresources &
	##  Always allow force-kill of xorg
	setxkbmap -option terminate:ctrl_alt_bksp
	##  Systems which require screen rotation can do that here
	/usr/bin/xrandr --output VGA-1 --rotate left --mode 1280x1024 --rate 75.02
	##  Window manager of choice
	exec i3

Now when I start up i3-wm with the startx command, it starts in the "correct" orientation to be directly usable without me having to switch all the axis around in my head before moving my hand. :)

Even better, my old i3-wm config rotation commands still stack on top of this change, so I've left them in the config in case I need to quickly rotate one way or the other, and don't want to restart my wm session.

Change font size

Lastly, my eyes are pretty bad. I'm probably getting down to "legally blind" uncorrected, and corrected isn't a whole lot better, sadly.

The default console font size on Devuan is a bit too small for me, especially with a framebuffer console. (It looks fancy, but diminishes readability pretty steeply for me.)

This is a pretty common thing to fiddle with, I just don't do it often enough to remember how to do it, each time.

If you do not already have the needed package installed, do that, and you should be prompted for your choices:

	sudo apt-get install console-setup

If you do already have this installed, as may be the case as it is not a default package, run the configuration for it over again:

	sudo dpkg-reconfigure console-setup

When asked, choose the character set you prefer or require (I like UTF-8):

set selection

The next choice involves deciding which type of character set you wish to use. If you aren't sure, choose what is already selected, or "Guess optimal character type", if you're feeling adventuresome.

character set

Next, choose "Terminus" from the font list, and choose a size for the characters (note that if you are not using a framebuffer you may be limited to VGA and TerminusBoldVGA options, rather than vanilla Terminus):


I like 12x24 or 14x28, depending on my monitor. Though if you aren't as impaired as I am, you can probably go with something smaller.

Note that if you do not like the changes, you can roll them back out by starting over, selecting "Fixed width", and 8x16 (which is generally the default). This should get you back where you started, unless you started from somewhere other than the default, of course.

font size

Excellent, now I won't make my eyesight worse, nor will I feel dizzy or disoriented when first starting this machine.

© 1995-2020 clover