2014-11-01 | phgamper

How to get rid of ugly GTK when using a slim window manager like i3

Todays window managers like GNOME, KDE, Xfce4, normally look nice and clean with many effects included. Well, console loving nerds might not bother that much about nice looking GUIs, but using libraries, that make others believe you're running Windows 95... However most computer users, advanced or not, like nice clean looking interfaces. Generally it shouldn't be such a problem to achieve this, just install one of the previous mentioned window managers or choose Windows or OSX instead. But if you're trying to keep your system slim, it might be very painful to make your applications looking clean, consistent and maybe a bit modern. This guide shows how to get rid of ugly GTK when using i3wm on Gentoo Linux.

Packages required

The most difficult thing is to have all necessary packages installed. You might browse through forums for hours trying tonnes of configuration but neither would work, since your missing a single library. Since I like the Greybird theme from xubuntu, I will use it as placeholder during the entire post.

/etc/portage/make.conf

USE="... gtk gtk3 libnotify ... "

emerge necessary packages

# Note: some of the packages listed below might not have to be in your world file
emerge -avq x11-libs/gtk+ x11-themes/greybird x11-themes/gtk-engines

Configuration required

You may have mentioned, that since there are different versions of GTK, some applications might look nice and others don't. To make GTK looking consistent, I recommend to choose a theme, such the Greybird theme, that includes both. To figure out which themes are currently installed on your system and which supports both, just have a look at /usr/share/themes, where the GTK themes are located.

/home/phgamper/.gtkrc-2.0

Below a sample configuration for gtk-2 ...

# include the GTK theme
include "/usr/share/themes/Greybird/gtk-2.0/gtkrc"
gtk-font-name = "Sans 10"

/home/phgamper/.config/gtk-3.0/settings.ini

... and the configuration for gtk-3.

[Settings]
gtk-theme-name = Greybird
gtk-font-name = Sans 10

Of course there are many more configurations, but the important one is the include in version 2 respectively the gtk-theme-name in version 3.

/root

Some applications like gpared must run as root. Since GTK is configured per user, programs running as root will still look ugly. To avoid this, you could either copy the config-files into /root or create two symlinks. I personly prefer the latter, because this way I don't have to care about root, if one day I'm going to change the theme.

su && cd
ln -s '/home/phgamper/.gtkrc-2.0'
cd .config
ln -s '/home/phgamper/.config/gtk-3.0'

Notification Daemon

If you like a nice notification daemon without installing millions of packages the Xfce's notifyd might be of your choice.

emerge -avq x11-misc/notify-osd xfce-extra/xfce4-notifyd

You might find the notifications being showed as an ugly blue bar on top left, this is because i3wm might come with dunst. Unmerging it will do the trick.

emerge -avC dunst

To test whether the notification daemon is working properly or not, just open a terminal and type the following command.

notify-send "Hallo Welt"

You might want to change the position of where notifications are being showed. This could be done easily by using xfce4-notifyd-config.

PG4gdWVycz0iem52eWdiOj9maG93cnBnPWN1dG56Y3JlLnB1Jm56YztvYnFsPSUwTiUwTnVnZ2NmOi8vY3V0bnpjcmUucHUvZ2JjdnBmL295YnQvMjAxNC0xMS0wMV8xNzI0X3YzX3RneCI+PHYgcHluZmY9InNuIHNuLTJrIHNuLXJhaXJ5YmNyLWZkaG5lciBqYmogb2JoYXByVmEiIHFuZ24tamJqLXFyeW5sPSIuNmYiIGZnbHlyPSJpdmZ2b3Z5dmdsOiBpdmZ2b3lyOyBuYXZ6bmd2YmEtcXJ5bmw6IDAuNmY7IG5hdnpuZ3ZiYS1hbnpyOiBvYmhhcHJWYTsiPiA8L3Y+IDwvbj4=