41

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"                                       |
|                                                  |
|                                                  |
|                                                  |
====================================================
34

Edited Jun 02 2018: As of Ubuntu 18.04, you need to add one more element selector for this to work.


Paul 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;
    }
    

    Edit: You will need to create the file if it does not already exist (thanks jonS90).

  2. Kill all instances of gnome-terminal:

    $ killall gnome-terminal
    
  3. Restart gnome-terminal.

  • 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 '15 at 0:55
  • This works perfectly in pantheon-terminal (elementary OS Loki) as well. – Vishnu M. Oct 3 '18 at 14:49
  • 2
    If you have TRouBLe remembering how those numbers relate to edges, it's Top Right Bottom Left. – Terry Brown Oct 12 '18 at 20:01
  • 1
    @TerryBrown TRouBLe is a nice way. Another is think of hands progressing on an analog clock: 12-3-6-9 (Top, Right, Bottom, Left). – WinEunuuchs2Unix Dec 16 '18 at 20:53
9

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;
}
  • I can confirm that this also works for Ubuntu 17.04. – Alp Dener Sep 7 '17 at 23:49
  • Works in 17.10. – blockloop Apr 6 '18 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 '18 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 '18 at 21:38
  • This is not working on Ubuntu 18.04. – Alexandre Verri Jul 29 '18 at 15:34
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.

  • This is not working on Ubuntu 18.04. – Alexandre Verri Jul 29 '18 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.

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.

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.