How to set borders around windows in 14.04?

Solution 1:

I appreciate the work around provided by the first answer. However, I was very specifically looking for a method of using the actually components as provided by the distribution if it exists.

At present you can copy your favorite theme from /usr/share/theme to ~/.theme. Name the theme folder something different from what it was named in the /usr/share/theme. This way when you select your chosen them you'll find it by the name you called the folder.

Example:

$ cp -R /usr/share/themes/Radiance/ ~/.themes/MyRadiance

This is a per-user operation and doesn't require elevated access.

Now you can edit the gtk-3 folder of that new directory to make your borders any way you want them. You can also customize other components of the theme.

The borders can be resized by editing the UnityDecoration features of the unity.css file located in the apps folder:

~/.themes/MyRadiance/gtk-3.0/apps/unity.css

To change the borders change the 0's to a different number of the parameter:

-UnityDecoration-extents: 28px 0 0 0;

You'll find many other editible features in the gtk-3.x folder.

For other features of the borders such as color, text, etc... take a look at Unity/Theming at:

https://wiki.ubuntu.com/Unity/Theming

I appreciate the previous workaround. But I hope many can benefit from using the feature as distributed by the OS developers.

Oh yea, to use this newly edited theme you'll have to install the unity tweak tool.

$ sudo apt-get install unity-tweak-tool

Note: I already linked this question to a similar question about Ambiance configuration. This resolution can easily be applied to any modern Ubuntu theme... not just Ambiance (or the Radiance reference mentioned in this particular instance).

Solution 2:

17.10

fragfutter's answer worked for me!

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

  2. Add the lines:

    decoration { border: 1px solid gray; background: gray; }

  3. Reboot (or you could probably just log out and back in to gnome)

Earlier versions of Ubuntu

Here is a shell-script version of my favorite part of L. D. James's excellent answer:

17.04 uses gtk-3.20

sudo sed -i -e \
's/-UnityDecoration-extents: 28px 0 0 0;/-UnityDecoration-extents: 28px 2 2 2;/' \
/usr/share/themes/Ambiance/gtk-3.20/apps/unity.css

16.04 and 15.10 use gtk-3.0

sudo sed -i -e \
's/-UnityDecoration-extents: 28px 0 0 0;/-UnityDecoration-extents: 28px 2 2 2;/' \
/usr/share/themes/Ambiance/gtk-3.0/apps/unity.css

You'll have to log out, then log back in to see the results of this change. You can replace Ambiance (the default) with Radiance or whatever theme you're currently using.

How does it work?

sed is a command line utility that replaces text.

Ending a line with \ tells the shell that the command continues on the next line (for human readability).

-i tells sed to edit the file in-place (don't make a new file).

-e tells sed that what follows is the sed script (instead of reading it from a file).

s/.../.../ the s means to substitute what's between the first two slashes with what's between the second two slashes. It only makes one substitution (because there is no /g at the end).