Giving Gnome-Terminal some margins makes me happier with it

March 30, 2023

For reasons outside the scope of this entry, I've recently been giving Gnome-Terminal more of a try as my secondary terminal program, instead of urxvt (my primary terminal program remains xterm). Gnome-Terminal is a perfectly fine default terminal program and so most of this has gone perfectly well. But the more I used gnome-terminal, the more I found myself having problems with how by default it runs the text almost right up against the edge of the window (on the left) and the scrollbar (on the right). I found that gnome-terminal's lack of margins made it harder for me to read and scan text at either edge.

(This is an interesting effect because xterm also runs text up to about the same few pixels from the left and right edges, but somehow xterm comes off as more readable and I've never felt it was an issue. Some of it may be that xterm has a quite different rendering for its scrollbar, one that I think creates the impression of more margin than actually exists, and by default puts it on the left side instead of the right. And of course I usually have much more text up against the left side than the right.)

Fortunately it turns out that this is fixable. Gnome-terminal is a GTK application and modern GTK applications can be styled through a fearsome array of custom CSS (yes, the web thing, it's everywhere and for good reason). Courtesy of this AskUbuntu question and its answers, I discovered that all you need is ~/.config/gtk-3.0/gtk.css with a little bit in it:

vte-terminal {
     padding: 4px 4px 4px 4px;
     -VteTerminal-inner-border: 4px 4px 4px 4px;

The 4px is experimentally determined; I started with the answer's 10px and narrowed it down until it felt about right (erring on the side of more rather than less space).

I've only tested this with gnome-terminal, so it's possible that it will make other VTE based terminal programs unhappy (although I tried xfce4-terminal briefly and it seemed okay). However, in gnome-terminal it makes me happy.

(In the way of the modern world, you need this gtk.css on every remote machine that you intend to run gnome-terminal on with X over SSH. Conveniently, in my case this is effectively none of them; we don't install gnome-terminal on our Ubuntu servers any more. We do install xterm.)

Written on 30 March 2023.
« The case of the very wrong email Content-Transfer-Encoding
Exploiting (or abusing) password fields for Multi-Factor Authentication »

Page tools: View Source, Add Comment.
Login: Password:
Atom Syndication: Recent Comments.

Last modified: Thu Mar 30 23:24:39 2023
This dinky wiki is brought to you by the Insane Hackers Guild, Python sub-branch.