58

I'd like to increase the padding in the gnome terminal, because the default has no padding and hurts my eyes.

Padding as in: I want space between the window border and where the text input/output is displayed.

For example:

=[X][-][ ]=============My Terminal==================
|                                                  |
|  $> echo "Padding occurs on both sides for long  |
|     input"                                       |
|                                                  |
|                                                  |
|                                                  |
====================================================

9 Answers 9

58

paulusm was mostly right. This expanded solution works as of Ubuntu 14.04.1 with GNOME Terminal 3.6.2.

For all versions

  1. Add the following code to ~/.config/gtk-3.0/gtk.css:

     VteTerminal,
     TerminalScreen,
     vte-terminal {
         padding: 10px 10px 10px 10px;
         -VteTerminal-inner-border: 10px 10px 10px 10px;
     }
    

    You will need to create the file if it does not already exist.

  2. Kill all instances of gnome-terminal:

    killall gnome-terminal
    
  3. Restart gnome-terminal.

As of Ubuntu 18.04, you need to add one more element selector for this to work.

6
  • 2
    The specified gtk.css file did not exist on my system. I had to create it (and then the solution worked).
    – jonS90
    Feb 15, 2015 at 0:55
  • 1
    This works perfectly in pantheon-terminal (elementary OS Loki) as well.
    – Vishnu M.
    Oct 3, 2018 at 14:49
  • 2
    If you have TRouBLe remembering how those numbers relate to edges, it's Top Right Bottom Left. Oct 12, 2018 at 20:01
  • 2
    @TerryBrown TRouBLe is a nice way. Another is think of hands progressing on an analog clock: 12-3-6-9 (Top, Right, Bottom, Left). Dec 16, 2018 at 20:53
  • Skipping ahead to 2022, still works great with both gnome-terminal and terminator on Debian 11. Thanks a bunch, I really enjoyed the inner gap feature of Alacritty, perfect to see it's doable for a tiled terminal such as Terminator! Cheers Apr 4, 2022 at 18:45
15

I tried all answers here on Ubuntu 16.10 with gnome-terminal 3.20.2 and they didn't work. I found the up-to-date solution in this launchpad thread. In the file ~/.config/gtk-3.0/gtk.css (which you may need to create), add this:

vte-terminal {
    padding: 10px;
}
7
  • 1
    I can confirm that this also works for Ubuntu 17.04.
    – Alp Dener
    Sep 7, 2017 at 23:49
  • Works in 17.10.
    – blockloop
    Apr 6, 2018 at 2:47
  • So, do I create gtk.css to only have your 3 lines? Or, how can I create a default one?
    – Robin Hsu
    Apr 24, 2018 at 11:32
  • @RobinHsu if the file exists, add this to the end. If it doesn't, create it, and only add this.
    – phrz
    May 8, 2018 at 21:38
  • 1
    for me this is working with ubuntu 20.04
    – makim
    Sep 6, 2020 at 22:25
4

To move the terminal output away from the window borders create the stylesheet ~/.config/gtk-3.0/gtk.css with the following setting:

TerminalScreen {
 -VteTerminal-inner-border: 10px 10px 10px 10px;
}

https://bbs.archlinux.org/viewtopic.php?id=163964

3

You can do it with some terminals, for example old xterm

xterm -b 10 -title "-b 10" -e nano &
xterm -title "no border spec" -e nano & 

In the manual man xterm you find how to set fonts, foreground and background colours. Maybe a little tricky to configure, but very flexible.

3

Please go through this issue - Unity Terminal 16.04

The Comment on the Wishlist describes is very proper solutions for Ubuntu 16.04 Terminals, where we need to change file ~/.config/gtk-3.0/gtk.css:

VteTerminal,
TerminalScreen {
    padding: 10px 10px 10px 10px;
    -VteTerminal-inner-border: 10px 10px 10px 10px;
}

TO

VteTerminal {
    padding: 10px;
}

padding works the same as normal CSS padding.

1
  • This is not working on Ubuntu 18.04. Jul 29, 2018 at 15:34
2

Back in the old days there used to be X Resources. Creating a .Xdefaults or .Xresources file in your home directory you could change all sorts of settings for graphical applications.

System wide defaults on my box are found in /etc/X11/Xresources and /etc/X11/app-defaults but i don't know if gnome-terminal cares for any of those.

Edit: also, this seems "theme department", so editing theme files or starting gnome-terminal with a custom .gtkrc file could do the trick, something like

$ GTK2_RC_FILES=~/custom-gtkrc gnome-terminal

in the terminal, or editing the gnome-terminal.destktop above to look like

Exec=env GTK2_RC_FILES=/home/you/custom-gtkrc gnome-terminal

could work.

2

Updated for Ubuntu 22.10 - missing gtk.css file

When I went to ~/.config/gtk-3.0, I couldn't find a gtk.css file. If this is what you're struggling with, here's what you should do:

  1. Open a terminal window. On Ubuntu, you can use the shortcut Ctrl+Alt+T.
  2. Type cd ~/.config/gtk-3.0. This will bring you to the folder where we'll make gtk.css. The ~ tilde represents the root directory, or /home in Ubuntu.
  3. Type > gtk.css into the terminal. This will create a file called gtk.css, where you'll be able to make changes.
  4. Open the gtk.css file in your preferred text editor.
  5. Make whatever changes you want to the css. To increase the padding, add this:
 VteTerminal,
 TerminalScreen,
 vte-terminal {
     padding: 10px 10px 10px 10px;
     -VteTerminal-inner-border: 10px 10px 10px 10px;
 }
  1. Save, exit, and reload the terminal.

The changes should now appear when you open a new terminal window.

1
1

I couldn't find a padding parameter in the gconf or dconf editor. I did a search on "terminal" with the Software Center and found a number of terminal applications. Gnome used to make it easy to specify different terminal applications but things have changed a bit. /usr/share/applications/gnome-terminal.desktop is where the terminal application to execute is specified. Open that file and you'll find:

[New Shortcut Group]
Name=New Terminal
Exec=gnome-terminal
TargetEnvironment=Unity

The Exec=gnome-terminal can be changed to select a different terminal application. Editing this file is a little involved because their mime type isn't recognized by naultilus as editable. You'll need to initiate the edit from the command line as follows:

sudo gedit /usr/share/applications/gnome-terminal.desktop

Having made that change the terminal application can be initiated the same as before but your alternative terminal application will be run.

1

Alternatively, I've used the workaround where you change the theme's (metacity 2) left_width parameter to 15 or 20 pixels.

This makes the window border thick on the left side and moves the effective left margin inside the window. This works okay for me as the window border color and background color for the terminal are close.

I researched this thoroughly and the only other way to do it is to switch to the xterm terminal as mentioned above. However, configuring xterm is a pain and has to be done through the .Xresources config file, there is no menu with xterm.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .