Difference between revisions of "GTK+"

From ArchWiki
Jump to: navigation, search
m (" don't " -> " do not ")
Line 19: Line 19:
  
 
=== GTK+ 1.x ===
 
=== GTK+ 1.x ===
Old GTK+ 1 apps (like xmms) often don't look very nice at first. This is because they use ugly themes by default.
+
Old GTK+ 1 apps (like xmms) often do not look very nice at first. This is because they use ugly themes by default.
 
To change this, you need to:
 
To change this, you need to:
 
# download and install some nice themes
 
# download and install some nice themes
Line 90: Line 90:
 
Note: There probably are other themes. Some of these themes are available in AUR. Also, some of them are not usable as is for displaying a GTK+ 2.x panel (light text over light background), so you need to use the provided panel background.
 
Note: There probably are other themes. Some of these themes are available in AUR. Also, some of them are not usable as is for displaying a GTK+ 2.x panel (light text over light background), so you need to use the provided panel background.
 
=== GTK+ and QT ===
 
=== GTK+ and QT ===
If you have GTK+ and QT (KDE) applications on your desktop then you know that their looks don't blend well. If you wish to make your GTK+ styles match your QT styles please read [[Uniform Look for QT and GTK Applications]].
+
If you have GTK+ and QT (KDE) applications on your desktop then you know that their looks do not blend well. If you wish to make your GTK+ styles match your QT styles please read [[Uniform Look for QT and GTK Applications]].
  
 
== Configuration ==
 
== Configuration ==
Line 110: Line 110:
 
=== Reduce widget sizes ===
 
=== Reduce widget sizes ===
  
If you have a small screen or you just don't like big icons and widgets, you can resize things easily.  
+
If you have a small screen or you just do not like big icons and widgets, you can resize things easily.  
 
To have icons without text in toolbars, use
 
To have icons without text in toolbars, use
 
  gtk-toolbar-style = GTK_TOOLBAR_ICONS
 
  gtk-toolbar-style = GTK_TOOLBAR_ICONS

Revision as of 22:15, 3 October 2011

This template has only maintenance purposes. For linking to local translations please use interlanguage links, see Help:i18n#Interlanguage links.


Local languages: Català – Dansk – English – Español – Esperanto – Hrvatski – Indonesia – Italiano – Lietuviškai – Magyar – Nederlands – Norsk Bokmål – Polski – Português – Slovenský – Česky – Ελληνικά – Български – Русский – Српски – Українська – עברית – العربية – ไทย – 日本語 – 正體中文 – 简体中文 – 한국어


External languages (all articles in these languages should be moved to the external wiki): Deutsch – Français – Română – Suomi – Svenska – Tiếng Việt – Türkçe – فارسی

Summary help replacing me
This articles details theme configuration of GTK+ applications. GTK+ (GIMP Toolkit) is a cross-platform widget toolkit for creating graphical user interfaces. This article will explore the tools used to configure the GTK+ theme, style, icon, font and font size, and also detail manual configuration.
Related
Uniform Look for QT and GTK Applications
Qt
GNU Project

From the GTK+ website:

GTK+, or the GIMP Toolkit, is a multi-platform toolkit for creating graphical user interfaces. Offering a complete set of widgets, GTK+ is suitable for projects ranging from small one-off tools to complete application suites.

GTK+, The GIMP Toolkit, was initially made by the GNU Project for Gimp but is now a very popular toolkit with bindings for many languages.

Themes

GTK+ 1.x

Old GTK+ 1 apps (like xmms) often do not look very nice at first. This is because they use ugly themes by default. To change this, you need to:

  1. download and install some nice themes
  2. change the theme

Some nice themes are in AUR. To install them, see gtk-smooth-engine.

To change the theme you can use gtk-theme-switch:

# pacman -S gtk-theme-switch2

Run it with the 'switch' command.

GTK+ 2.x

Major Desktop Environments provide tools to configure the GTK+ theme, icons, font and font size. Alternatively, tools such as Template:Package Official, Template:Package Official, Template:Package Official and Template:Package Official may be used. Template:Package Official is a DE independent configuration tool from the LXDE project, which does not require any other parts of LXDE. Install one of these packages, as below:

# pacman -S lxappearance

# pacman -S gtk-chtheme

# pacman -S gtk-theme-switch2

# pacman -S gtk2_prefs

It is recommended to install some GTK+ 2 themes as well. The popular Clearlooks theme is included within the Template:Package Official package:

# pacman -S gtk-engines

Further themes can be found in AUR:

Alternatively, GTK+ settings can be configured manually by editing Template:Filename. A list of GTK+ settings can be found in the gnome library. To manually change the GTK+ theme, icons, font and font size, add the following to Template:Filename:

Template:File

For example: Template:File

Note: The above example requires the packages Template:Package Official, Template:Package Official, Template:Package Official and murrine-themes-collection (from AUR).

GTK+ 3.x

If you use GNOME 3 DE, the theme can be changed with gnome-tweak-tool. Install with

# pacman -S gnome-tweak-tool

If you use a GTK+ 2.x based DE, like Xfce, LXDE, gnome-tweak-tool won't work; see FS#23633. You need to install librsvg

# pacman -S librsvg

and set your theme manually in Template:Filename (this is usually Template:Filename. An example Template:Filename file: Template:File After this, you need to set the same theme in your DE's appearance configuration tool. There are only a few themes which provide a uniform look for GTK+ 3.x and GTK+ 2.x apps. A few examples:

  1. Adwaita for GTK+ 3 and Advaicium for GTK+ 2
  2. Newlooks for GKT+ 3 and Clearlooks for GTK+ 2
  3. Zukitwo
  4. Elegant Brit
  5. Atolm
  6. Hope

Note: There probably are other themes. Some of these themes are available in AUR. Also, some of them are not usable as is for displaying a GTK+ 2.x panel (light text over light background), so you need to use the provided panel background.

GTK+ and QT

If you have GTK+ and QT (KDE) applications on your desktop then you know that their looks do not blend well. If you wish to make your GTK+ styles match your QT styles please read Uniform Look for QT and GTK Applications.

Configuration

Note: See the GNOME library for the full list of GTK configuration options.

The purpose of this section is to collect GTK configuration settings which can e.g. be used within Template:Codeline.

Enabling Customizable Keyboard Shortcuts

You can customize your GTK applications' keyboard shortcuts (those are called accelerators in GTK terminology) by hovering your mouse over a menu item and pressing your desired key combination. However, this feature is disabled by default. To enable it, set

gtk-can-change-accels = 1

Speed up your GNOME menu

This setting controls the delay between you pointing the mouse at a menu and that menu opening in GNOME. Change this to a setting you prefer. I guess the number is in milliseconds, e.g. 250 being a quarter of a second.

gtk-menu-popup-delay = 0

Reduce widget sizes

If you have a small screen or you just do not like big icons and widgets, you can resize things easily. To have icons without text in toolbars, use

gtk-toolbar-style = GTK_TOOLBAR_ICONS

To use smaller icons, use a line like this:

gtk-icon-sizes = "panel-menu=16,16:panel=16,16:gtk-menu=16,16:gtk-large-toolbar=16,16\
:gtk-small-toolbar=16,16:gtk-button=16,16"

Or to remove icons from buttons completely:

gtk-button-images = 0

You can also remove icons from menus:

gtk-menu-images = 0

There is some more tweaking to do in your themes gtkrc like explained here and there's another theme that does it all.

Compiling GTK+ programs

When writing a start-from-scratch GTK+ program with C, it's necessary to add CFLAGS for gcc (the code was adopted from ubuntu forum):

gcc -g -Wall `pkg-config --cflags --libs gtk+-2.0` -o base base.c

-g and -Wall parameters are not necessary since they are only for verbose debugging outputs. You may try out the official Hello World example provided by the gtk.org.

Resources