How to enable/add window borders in 17.10 & 18.04?

I found the answer here.

  1. Make a file ~/.config/gtk-3.0/gtk.css

  2. Add the lines:

    decoration {
      border: 1px solid gray;
      background: gray;
    }
    
  3. Reboot or log out+log in


The following adds the border only to gnome-terminal windows; tested on GNOME 3.22 (in Debian 9).

  1. Make/edit the file ~/.config/gtk-3.0/gtk.css
  2. Add the following:

    terminal-window notebook {
      border-width: 0px 1px 1px 1px;
      border-style: solid;
      border-color: grey;
    }
    
      terminal-window.maximized notebook,
      terminal-window.fullscreen notebook {
      border-style: none;
    }
    
  3. Log out/log in

I don't really like that bright gray, here's my preference for ~/.config/gtk-3.0/gtk.css (rgba colors only worked in wayland for me, so I settled on #383838.)

terminal-window notebook {
  border: 1px solid #383838;
}

But that alone doesn't work for emacs, so I also add:

/* for emacs */
window#Emacs.background box#pane {
  border-style: solid;
  border-color: rgba(0,0,0,0.75);
  border-width: 0 1px 1px 1px;
}

Here's the pretty, subtle result:

nice subtle window borders

Bonus / note to self: you can test and tweak css using the GTK inspector, e.g.: GTK_DEBUG=interactive emacs (tutorial) - and a reference for how gtk CSS selectors work.