How to Add 👉
👈 Padding to the Ubuntu Gnome Terminal
I often make screen captures of terminal outputs while documenting my work or helping colleagues and was always bothered when its contents were too close to the left border.
Adding padding to the gnome terminal on Ubuntu, and likely any distribution using Gnome, is trivial, as it suffices to edit ~/.config/gtk-3.0/gtk.css
.
Seeing as I’ve been wanting to document this for awhile already; going against my “principle of addressing issues as soon as they become an annoyance” once again, I figured I’d just put this note out there.
Addendum
Once you’re done reading this article, you can continue by having a look at the related content I’ve linked below.
Related Posts
I haven’t found much information about this particular file in the official Gnome documentation, but there’s some useful conversation surrounding it on the ArchLinux wiki. If you want to delve deeper into what tweaks might be possible, you should have a look at the GTK Supported CSS Properties or even browse the official Gnome GitLab where the GTK CSS parsing code is hosted
If the file doesn’t exist as evidenced by an empty ls ~/.config/gtk-3.0/gtk.css
, create it using touch ~/.config/gtk-3.0/gtk.css
and put the following into it:
VteTerminal,
TerminalScreen,
vte-terminal {
padding: 10px 10px 10px 10px;
-VteTerminal-inner-border: 10px 10px 10px 10px;
}
In case the contents of ~/.config/gtk-3.0/gtk.css
are not valid, the GTK will complain once you try to start a gnome-terminal
since it wasn’t able to load the theme file. Make sure you’ve put the content as shown above in the file and save.
Finally, you’ll need to terminate all gnome terminal processes. You’ll often see mention of pkill gnome-terminal
online, but gnome-terminal
only calls gnome-terminal-server
which in turn actually spawns the desired terminal. Therefore, pkill gnome-terminal
might be insufficient. If that is the case, find the process identifier of the gnome-terminal-server
using ps -fea | grep term
and then terminate it using kill <process identifier>
as shown below.
After you’ve done that, your terminal will have 10px
of padding on every border:
Final Words
I hope you enjoyed this short post! Feel free to look at this one where I compare different programming typefaces.
Stay in touch by entering your email below and receive updates whenever I post something new:
As always, thank you for reading and remember that feedback is welcome and appreciated; you may contact me via email or social media. Let me know if there's anything else you'd like to know, something you'd like to have corrected, translated, added or clarified further.