Aug 26, 2014

How To Disable GTK3 Client-Side Decorations (Header Bars)

Starting with GNOME 3.10, some GNOME applications have switched to "header bars" or "client-side decorations". These CSD (client-side decorations) don't work properly in some desktop environments / shells - for instance, in Ubuntu 14.04, Unity doesn't support CSD and because of this, some applications look broken. Luckily, there is now a relatively easy way (unofficial) of disabling client-side decorations. Read on!

In Ubuntu, Nautilus and a few other GNOME apps are patched so they don't use client-side decorations under Unity. However, not all applications were fixed - here are a few examples:

GNOME Clocks

Latest gThumb 3.3.2 (gThumb from the Ubuntu repositories was downgraded when the Ubuntu devs noticed it's using CSD)


PCMan, one of the LXDE founders, has created gtk3-nocsd, a small module which can be used to disable the GTK+3 client-side decorations. gtk3-nocsd can achieves this by letting GTK think there's no compositor available, in which case the CSD fail to start.

Here are the same 3 applications as above, with gtk3-nocsd (so with disabled client-side decorations):

There are a couple of issues though. The first one is that this solution seems to work with most, but not all CSD applications - in my test, GNOME Weather continued to use client-side decorations even after using gtk3-nocsd. And the second issue is that the CSD close button isn't removed when the client-side decorations are disabled:

Install gtk3-nocsd

Ubuntu 14.04 or 14.10 users can install gtk3-nocsd by using the main WebUpd8 PPA. To add the PPA and install gtk3-nocsd, use the following commands:

sudo add-apt-repository ppa:nilarimogard/webupd8
sudo apt-get update
sudo apt-get install gtk3-nocsd

Or, if you don't want to add the PPA, download the gtk3-nocsd deb from HERE.

Other Linux distributions: grab the gtk3-nocsd code from GitHub, make sure pkg-config and gtk+3-dev are installed and compile it using "./".

Simply installing gtk3-nocsd won't disable the GTK3 client-side decorations. See the example below for how to use it.

Disable GTK3 client-side decorations using gtk3-nocsd (example)

To be able to use gtk3-nocsd, you need to preload the file (which is installed under /usr/lib/gtk3-nocsd/ if you've used the Ubuntu PPA mentioned above) using LD_PRELOAD.

The gtk3-nocsd GitHub page suggests adding the following to ~/.profile:

export GTK_CSD=0
export LD_PRELOAD=/path/to/

However, by using this, Unity failed to start in my test so don't use it unless you know what you're doing and you're not using Unity! Instead, you can simply add LD_PRELOAD to the desktop file, which won't affect the environment.

Here's an example: to disable the client-side decorations for gThumb 3.3.2, open its desktop file as root with a text editor (I'll use Gedit below):

gksu gedit /usr/share/applications/gthumb.desktop

And in this file, search for the line that starts with "Exec=" and right after "=" and before "gthumb", add the following (without removing anything!):

env LD_PRELOAD=/usr/lib/gtk3-nocsd/

After editing gthumb.desktop, the "Exec=" line should look like this:

Exec=env LD_PRELOAD=/usr/lib/gtk3-nocsd/ gthumb %U

In the same way you can disable client-side decorations for any application you want: GNOME Clocks, GNOME Maps, etc.

via Web Upd8 - Ubuntu / Linux blog