How can I enable the GTK3 header bars on Ubuntu 16.04?

  1. You can enable that by creating new file

    sudo nano /etc/profile.d/csd.sh
    
  2. That contains

    export GTK_CSD=1
    export XDG_CURRENT_DESKTOP=Unity:GNOME
    
    #export GTK_THEME=Ambiance
    #export GTK_THEME=Adwaita:dark
    
  3. Logout/Login

Reference: for the new colon format Unity:GNOME. https://bugs.launchpad.net/ubuntu/+source/nautilus/+bug/1554878

Related question: What is the default GTK 3 Theme Engine in Ubuntu Unity?

Related page: A Fix For Black Corners Around CSD Windows in Ubuntu?

Tests:

  • Bharadwaj Raju's solution is the best for now

    Using /etc/profile..

    export XDG_CURRENT_DESKTOP=GNOME
    

    gnome-software OK, gnome-calculator OK, nautilus OK (black sharp corners, get smaller if killed then launched again), unity-control-center FAIL (No components, should run with XDG_CURRENT_DESKTOP=Unity)

  • Mine (See above):

    gnome-software NO, gnome-calculator NO, nautilus OK (black sharp corners, get smaller if killed then launched again they go), unity-control-center NO.

  • Another try with export XDG_CURRENT_DESKTOP=""

    gnome-software OK, gnome-calculator OK, nautilus FAIL, unity-control-center FAIL.


For specific GTK3 apps

Edit their .desktop file (Nautilus' is located at /usr/share/applications/nautilus.desktop)

And add env XDG_CURRENT_DESKTOP=GNOME just after each Exec= line. For example, nautilus.desktop's Exec= line(s) (It has two, one for opening a new window) will change from...

Exec=nautilus --new-window %U
[… Some other lines, skipping …]
Exec=nautilus --new-window

to

Exec=env XDG_CURRENT_DESKTOP=GNOME nautilus --new-window %U
[… Some other lines, skipping …]
Exec=env XDG_CURRENT_DESKTOP=GNOME nautilus --new-window

NOTE: If you use Unity, do the same to /usr/share/applications/nautilus-autostart.desktop and/or /etc/xdg/autostart/nautilus-autostart.desktop.

(You may have to logout/login.)

For all GTK3 apps

Word of warning: Telling all apps that the DE is GNOME may result in side effects.

Edit: Unity fails to start with this.

Edit ~/.profile and add a line:

export XDG_CURRENT_DESKTOP=GNOME

then all apps will obey this.