12

I want to see the applications like when running on Gnome 3 (with the buttons in the title bar):

Gnome

Instead of how I see them normally:

Unity

I can achieve what I want by running these commands before starting any application:

export GTK_CSD=1
export XDG_CURRENT_DESKTOP=GNOME

I've tried to edit this file to make the changes permanent:

/usr/share/xsessions/ubuntu.desktop

In that file I change this:

DesktopNames=Unity

By this:

DesktopNames=GNOME

But then Unity will not start.

I'm finding a way of using the GTK3 header bars by default. Is this possible?

0x2b3bfa0
  • 8,620
  • 5
  • 38
  • 59

3 Answers3

4
  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.

user.dz
  • 47,137
  • 13
  • 140
  • 258
  • 1
    Only working with Nautilus. Also, it has black corners on the top. – 0x2b3bfa0 Jun 10 '16 at 21:31
  • @Helio, Could you tell me names of other tools you are testing? – user.dz Jun 11 '16 at 12:39
  • 1
    If you mean applications by tools, I tried gnome-calculator and gnome-softare also. – 0x2b3bfa0 Jun 11 '16 at 12:52
  • @Helio As far as I know the black corners are a Unity bug. –  Jun 11 '16 at 22:14
  • @BharadwajRaju: It seems like a unity bug... – 0x2b3bfa0 Jun 11 '16 at 22:47
  • 2
    `gnome-control-center` can be used as a replacement for `unity-control-center`, since the Unity one is basically a fork of the GNOME one. –  Jun 13 '16 at 07:30
  • @BharadwajRaju Yep, It does work. – user.dz Jun 13 '16 at 11:12
  • Why GNOME Builder works perfectly with its header bars? – 0x2b3bfa0 Jun 13 '16 at 11:27
  • @Helio Does the black-corner issue occur with a different theme? Say, Arc? (I've seen Arc + Header bars + Unity work perfectly) –  Jun 13 '16 at 11:35
  • @Helio, All these seems weird to me, each application have different behavior to each of those environment variables. In the XFCE calculator & softwares launch in CSD mode! There should be a hidden trick some where. – user.dz Jun 13 '16 at 11:36
  • @Sneetsher: Maybe the program overrides the environment variables. I'll wait until the header bars become standard. – 0x2b3bfa0 Jun 13 '16 at 11:39
  • @BharadwajRaju: Arc theme untested. Testing now... – 0x2b3bfa0 Jun 13 '16 at 11:42
  • @BharadwajRaju: With the Arc theme, the corners are not rounded, so the problem doesn't exist. – 0x2b3bfa0 Jun 13 '16 at 11:52
  • @Helio Strange, Arc was designed to have rounded corners. [Screenshot](https://camo.githubusercontent.com/4c0001cbfe222446c4b3af91027b716daec7d3d7/687474703a2f2f692e696d6775722e636f6d2f5068354f624f612e706e67) –  Jun 13 '16 at 12:02
  • @BharadwajRaju: The black corners also are shown with arc, but they are white. Seems like this can be solved restarting Nautilus. http://imgur.com/JqDO2VR – 0x2b3bfa0 Jun 13 '16 at 12:26
3

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.

  • 1
    I think that your solution for nautilus is wrong because it starts on boot. The file that I would edit is `/etc/xdg/autostart/nautilus-autostart.desktop` – 0x2b3bfa0 Jun 01 '16 at 15:05
  • Ironically, in Cinnamon, this causes the window manager to decorate the titlebars as headerbars! – Dominic Hayes Feb 20 '17 at 17:24
0

Building off of user.dz, run

sudo nano /etc/profile.d/csd.sh

fill that with

export XDG_CURRENT_DESKTOP=GNOME

and then

cd /usr/share/applications
sudo sed -i 's/Exec=/Exec=env XDG_CURRENT_DESKTOP=Unity:Unity7 /g' unity*

login out and back in

Alternatively, change only the currently installed apps to run in CSD mode,

sudo sed -i 's/Exec=/Exec=env XDG_CURRENT_DESKTOP=GNOME /g' ^(?!unity).*$
Aaahh
  • 153
  • 7