Customizing GTK Apps

From awesome
Jump to: navigation, search

If you are used to GNOME, you might want to learn how to change your theme without using the GNOME Theme Manager. GTK apps first try to get their themeing information through an XSettings provider, such as gnome-settings-daemon or xsettings-kde, and in absence of these reverts to files, ~/.gtkrc for gtk2 apps, ~/.config/gtk-3.0/settings.ini for gtk3 apps.

Manually[edit]

Initial Setup[edit]

First, create a file called ".gtkrc-2.0" in your home folder, and put this line in it:

include '/home/<username>/.gtkrc.mine'

Next, create ".gtkrc-1.2-gnome2" and add the same line. Now create ".gtkrc.mine".

GTK Themes[edit]

To apply a theme, add this line to .gtkrc.mine:

gtk-theme-name = "Clearlooks"

replacing the example name with the name to the theme you want to use (probably in /home/<username>/.themes).

For GTK3 apps[edit]

create the file ~/.config/gtk-3.0/settings.ini with contents:

[Settings]

gtk-icon-theme-name = <icon-theme-name>

gtk-theme-name = <gtk-3-theme-name>

Icon Themes[edit]

To apply an icon theme, add this line to '.gtkrc.mine':

 gtk-icon-theme-name = "Tango"

The name of the icon theme can be found in the index.theme file in the theme folder (probably in ~/.icons).

Fonts[edit]

To change the fonts of GTK apps, add this to your '.gtkrc.mine' file:

style "schrift"
{
font_name = "DejaVu Sans 10"
}
widget_class "*" style "schrift"
gtk-font-name = "DejaVu Sans 10"

Toolbars[edit]

To change the look of certain apps' toolbars (like gedit), add one of the following lines to your '.gtkrc.mine' file:

gtk-toolbar-style   = GTK_TOOLBAR_ICONS              #Only icons
gtk-toolbar-style   = GTK_TOOLBAR_TEXT	             #Only text
gtk-toolbar-style   = GTK_TOOLBAR_BOTH	             #Both icons and text
gtk-toolbar-style   = GTK_TOOLBAR_BOTH_HORIZ	     #Icons and text next to the icons

You can also change the size of the icons:

gtk-toolbar-icon-size = 16,16

Automatically[edit]

There a few apps that you can use to change your theme without invoking gnome-settings-daemon:

Example[edit]

The following is an example '.gtkrc.mine' file:

##################
#      GTK       #
##################

include "/usr/share/themes/Clearlooks/gtk-2.0/gtkrc"


##################
#     FONTS      #
##################

style "schrift"
{
font_name = "Myriad Web 9"
}
widget_class "*" style "schrift"
gtk-font-name = "Myriad Web 9"


##################
#     ICONS      #
##################

gtk-icon-theme-name = "Crashbit"


##################
#    TOOLBARS    #
##################

gtk-toolbar-style   = GTK_TOOLBAR_ICONS