Unable to style borders on gnome-terminal

Bug #1736084 reported by Andy Smith on 2017-12-04
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
gnome-terminal (Ubuntu)
Undecided
Unassigned

Bug Description

As the default background colour for gnome-terminal is black, and windows have a black drop shadow, when several terminals are stacked on top of each other it is hard to see where one terminal ends and another begins.

I would like to add a coloured border to each gnome-terminal window.

I have been able to accomplish this with the following CSS in ~/.config/gtk-3.0/gtk.css:

@define-color border-grey #444;

decoration {
  border: 1px solid shade(@border-grey, 1);
  background: shade(@border-grey, 1);
}

This works, but it affects every single Gnome window for every application. Ideally I'd like to restrict this to gnome-terminal windows only.

I've tried:

vte-terminal {
  border: 1px solid shade(@border-grey, 1);
  background: shade(@border-grey, 1);
}

This doesn't appear to do anything. I know it is the correct CSS selector though, because if I add padding:

vte-terminal {
  border: 1px solid shade(@border-grey, 1);
  background: shade(@border-grey, 1);
  padding: 50px;
}

Then the padding takes effect when I save the file and start a new gnome-terminal with:

$ gnome-terminal --disable-factory

I have also tried a variety of different selectors found through many searches such as "TerminalScreen", "VteTerminal" and "widget". None of these seem to produce any effect, even for padding. As "vte-terminal" is the only one that does anything even for padding, I believe that "vte-terminal" must be the correct selector but setting a coloured border is simply not supported.

I have also tried using GTK+ Inspector to find the CSS selectors that gnome-terminal supports, but for some reason they aren't listed in the debug window.

If there is a way to set window border colour (only) with gnome-terminal, please could someone let me know?

If there's not then can this be a wishlist item?

ProblemType: Bug
DistroRelease: Ubuntu 17.10
Package: gnome-terminal 3.24.2-0ubuntu4
ProcVersionSignature: Ubuntu 4.13.0-17.20-generic 4.13.8
Uname: Linux 4.13.0-17-generic x86_64
NonfreeKernelModules: nvidia_uvm nvidia_drm nvidia_modeset nvidia
ApportVersion: 2.20.7-0ubuntu3.5
Architecture: amd64
CurrentDesktop: ubuntu:GNOME
Date: Mon Dec 4 07:57:55 2017
ExecutablePath: /usr/lib/gnome-terminal/gnome-terminal-server
InstallationDate: Installed on 2017-12-02 (1 days ago)
InstallationMedia: Ubuntu-Server 17.10 "Artful Aardvark" - Release amd64 (20171017.1)
ProcEnviron:
 LANG=en_GB.UTF-8
 LANGUAGE=en_GB:en
 PATH=(custom, no user)
 SHELL=/bin/bash
 XDG_RUNTIME_DIR=<set>
SourcePackage: gnome-terminal
UpgradeStatus: No upgrade log present (probably fresh install)

Andy Smith (grifferz) wrote :
Egmont Koblinger (egmont-gmail) wrote :

The first snippet you showed doesn't do anything for me (not even for other GNOME windows).

Anyway...

Could you please try "terminal-window" as the selector? This should match the toplevel window. Or some combination of "terminal-window" and "decoration"...

VTE is the terminal emulation widget, the area where the terminal emulation happens. As you increase its padding, you'll see that it does _not_ include the menubar and tab bar on the top, and the scrollbar on the right. Hence if you want to achieve something on the overall window, going for anything VTE-related isn't the right approach. (If there's a way to select on a "decoration" with the condition that it has a "vte-terminal" somewhere down among its descendants, then that might work too. I'm not sure if such selectors exist.)

Andy Smith (grifferz) wrote :

As a demonstration that the first snippet does work for at least some apps on my 17.10 system, please find attached a screenshot showing part of a gedit window loaded after making gtk.css look like this:

decoration {
  border: 10px solid shade(@border-grey, 1);
  background: shade(@border-grey, 1);
}

I'm 99% sure I already tried "terminal-window" as the selector but I'll give it another go in a little while when I haven't got a lot of work in progress.

It doesn't show any effect after saving the gtk.css and running "gnome-terminal --disable-factory", nor by restarting gnome shell with alt-F2 and "r", but I've found those are sometimes not enough to make gnome-terminal see changes, and will have to try fully logging out.

Andy Smith (grifferz) wrote :

(the example in comment #3 is missing the top line: @define-color border-grey #444;)

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers