Self-made Gubuntu

Saturday, May 5. 2012

Self-made Gubuntu

In 2010 the world was still in order: Kubuntu for KDE, Xubuntu for XFCE, Lubuntu for LXDE, Ubuntu for Gnome. This has changed now. The latest Ubuntu LTS release (And the two previous Non-LTS releases) are using Unity as user interface instead of Gnome. Unity is based on Gnome 3 but it is pretty different to a standard Gnome 3 environment (Which uses Gnome Shell). Hopefully some day there will be something like a Gubuntu distribution which focuses on a standard Gnome environment with Gnome Shell as user interface. But for now we have to get rid of Unity manually. This article explains how to do it and also describes some additional tweaks and hacks to make Gnome more usable.

Install Ubuntu

Not much to write here. Just install Ubuntu, no special settings needed. You will end up with the LightDM display manager and after login you'll see the Unity desktop. If you like Unity then you can stop reading because the next steps are not meant for you. If you don't like Unity but you also don't like Gnome 3 then I recommend using Mint Linux which contains a nice port of Gnome 2 called Mate. If you like Gnome 3 then continue reading.

Install Gnome 3

Open the Terminal application and install Gnome 3 by entering this command:

sudo apt-get install gnome

This downloads the complete Gnome environment which consists of more than 200 additional packages of somewhat around 160 MB to download. During the installation you are asked to choose between the display managers LightDM and GDM. Choose GDM if you like but you can also stick to LightDM if you want. While GDM comes from Gnome LightDM has nothing to do with Unity. So it's perfectly ok to use LightDM together with Gnome 3.

When installation is complete, log out, choose Gnome as Window Manager on the login screen and log in again.

Remove unwanted stuff

You are now using Gnome 3 but you still have lots of Ubuntu-specific stuff installed: The Ubuntu theme, the Ubuntu font, the overlay scrollbar, wallpapers and so on. This section describes how to get rid of all this stuff so in the end you have a standard Gnome 3 setup.

Remove unity

sudo apt-get --purge autoremove ^unity.* libunity-misc4 ^indicator.* ^appmenu.* .*-globalmenu$

This removes a whole bunch of packages. Double-check the listed packages before you confirm the deletion. Maybe Ubuntu changes some dependencies in the future and the above command also removes some gnome stuff so make sure there are only packages in the list of packages to be removed which matches the specified packages.

Remove LightDM

If you selected GDM as display manager then you no longer need LightDM. This command removes it:

sudo apt-get --purge autoremove lightdm liblightdm-gobject-1.0

Remove compiz

Gnome Shell doesn't use Compiz, so you can remove it:

sudo apt-get --purge autoremove compiz.*

Again double-check that this command only removes compiz packages before you confirm the deletion.

Remove overlay scrollbar

Execute this command to get rid of this nasty overlay scrollbar:

sudo apt-get --purge autoremove overlay-scrollbar.*

Remove Ubuntu artwork

To get rid of the ubuntu wallpapers, sounds and themes execute this command:

sudo apt-get --purge autoremove ubuntu-wallpapers.* ubuntu-artwork ubuntu-sounds light-themes adium-theme-ubuntu ubuntu-mono ttf-ubuntu-font-family

After running this command you have to reboot your machine. Gnome and the Gnome Display Manager now uses the standard Adwaita theme. To restore the original Look and Feel of Gnome 3 also select the Stripe wallpaper in the System Settings.

Tweak Gnome 3

This section describes some additional tweaks to make Gnome 3 more usable.

Gnome Tweak Tool

Lot's of configuration settings are no longer present in Gnome 3 (Like configuring the font antialiasing). Some of these settings can be made available again by installing the Gnome Tweak Tool:

sudo apt-get install gnome-tweak-tool

After installing this package you will find a new application called Advanced Settings in your application menu. I usually use this tool to configure the following stuff (But this only reflects my own sense of style):

  • Setting all fonts to the DejaVu font family with a size of 10px.
  • Setting font hinting to Full.
  • Enabling date and seconds in clock and enabling the week date in the calendar.
  • Enabling all buttons in the titlebar instead of just having a close button.
  • Disabling the file manager handling the desktop. As far as I know this feature is disabled by default in a standard Gnome installation and only enabled in Ubuntu by default. Gnome also has annoying problems with switching between single and dual monitor mode when this feature is enabled.

Font antialiasing with full hinting

Some applications like Firefox, Thunderbird, VLC, LibreOffice, Chromium and VirtualBox don't honor the font antialiasing setting you made in Gnome. So if you prefer full hinting you also have to configure the fontconfig settings by executing these commands:

sudo rm /etc/fonts/conf.d/10-hinting-slight.conf
sudo ln -s /etc/fonts/conf.avail/10-hinting-full.conf /etc/fonts/conf.d/

Now you also have full hinting in most non-Gnome applications.

Disable global F10 mapping

In Gnome 3 the F10 key is mapped to open the window menu. This is pretty annoying because some programs have their own mapping for this key (Midnight Commander for example). And for some reason it is quite hard to disable this key mapping in Gnome 3. You have to create the file ~/.config/gtk-3.0/gtk.css with this content:

@binding-set NoKeyboardNavigation
{
    unbind "<shift>F10"
}

*
{
    gtk-key-bindings: NoKeyboardNavigation
}

This disables the F10 key mapping in Gnome 3 itself but it is still mapped in the Terminal application. To disable it there (together with the mapping of F1) you have to do this:

  • Open the Terminal application.
  • Go to Edit / Keyboard Shortcuts.
  • Uncheck the checkbox Enable the menu shortcut key (F10 by default).
  • Remove the shortcut key for Help / Contents.

Fixing menu borders and separators in Java applications

Java applications which use the Swing GUI Toolkit with the GTK Look-and-Feel have no menu borders and no menu separators when the standard Gnome 3 theme Adwaita is used. To fix this you have to create the file ~/.themes/Default/gtk-2.0-key/gtkrc with this content:

style "menu" {
    xthickness = 1
    ythickness = 1
}

style "separator_menu_item" {
    ythickness = 1
}

Removing ugly and duplicate entries from the application menu

When you open the application menu of Gnome Shell then you see a lot of applications with low-resolution icons or no icons at all. Some applications even have duplicate entries: One with a high resolution icon and one with a low resolution icon. I haven't investigated this problem in detail but I think this is because there are two places where applications can register their launchers: The modern way (Most likely FreeDesktop stuff) and the old way. Looks like Gnome 3 reads the launchers from both places. You can remove this old way by removing the package menu:

sudo apt-get --purge autoremove menu

After removal of this package your application menu looks much better but also is somewhat smaller now because all those ugly launchers are gone. But so far I never missed anything. Most of these ugly icons where launchers for command-line programs anyway. I prefer launching command-line programs on the command line and having modern launchers with nice icons for GUI applications.

Configuring the look and feel of GDM

GDM 3 really is a pain in the ass and I guess that's the reason why Ubuntu switched to LightDM and why now there is even a port of the old GDM 2 (Which is called MDM (The Mate Display Manager) and which is now also used in Mint Linux). I never found out how to configure GDM 3 properly. I just want to set a background image and configure font antialiasing. Sounds pretty easy but how the hell does it work? Well, the easiest way I found so far is copying the dconf configuration of my user to the home directory of the gdm user after I finished setting up my own user configuration. Just two commands are needed for it:

sudo mkdir -p  ~gdm/.config/dconf
sudo cp ~/.config/dconf/user ~gdm/.config/dconf/

When you change your user configuration later and you want to synchronize your GDM settings with it you just have to run the second command again. If you selected a background image from your own home directory then make sure the gdm user has read access to it or otherwise the image won't appear on the login screen.

Fix vsync problems with Nvidia Nouveau driver

When you use the Open Source Nvidia driver nouveau then you might have problems with tearing artefacts when dragging windows or watching videos. You can fix this by creating the file /etc/X11/xorg.conf with this content:

Section "Device"
 Identifier "Nouveau"
 Option "GLXVBlank" "on"
EndSection

If you already have a device section in this file add the GLXVBlank option line to it.

Reboot your machine (Maybe a re-login is enough, haven't tested) and your tearing problems are history.

Gnome Extensions

Last but not least I want to mention the possibility of installing Gnome Extensions. There is a growing number of useful extensions out there which can be installed with some mouse clicks in your web browser (Finally it even works in Chromium). These are my favorite extensions:

Posted in Linux | Comments (5)
ubuntuprisoner at 2012-05-28 21:01
Thanks very much. Very useful tips.

Note, it is conf.avail not conf-avail.
Klaus Reimer at 2012-05-28 23:36
Corrected.
frank at 2012-06-04 08:02
>>> To fix menu borders and menu separators in Adwaita, Gnome3, you have to create the file ~/.themes/Default/gtk-2.0-key/gtkrc ...
>>>

Are path and name correct? It does not work in Ubuntu 12.04, Gnome Classic.
Klaus Reimer at 2012-06-04 09:05
Checked it again and yes, path and name is correct. When I remove the file then borders and menu separators are gone. Adding the file again fixes it. Which Java version are you using? I'm using OpenJDK 7 which is included in Ubuntu 12.04. Maybe it doesn't work with Oracle JDK. Oh, and I'm using Gnome Shell, never tried Gnome Classic. Maybe there is a difference, too.
Alvin B. at 2012-09-19 08:37
Thanks for this! I'm sick of the bloat pulled in from various other window managers and repositories I'd enabled on my Xubuntu install.

So, with your advice in hand, and a copy of virtualbox and ReMasterSys, I'm setting up a barebones Gnome only install of 12.04 LTS...

(yes I know there's a Gnome version of Ubuntu coming with 12.10, but I don't wanna run beta OS)...

Enclosing asterisks marks text as bold (*word*), underscore are made via _word_.