GTK

From Gentoo Wiki
Jump to:navigation Jump to:search
This article is a stub. Please help out by expanding it - how to get started.

GTK is a toolkit for creating graphical user interfaces. It is part of the GNU Project and maintained by GNOME.

Installation

Though GTK can be installed with the emerge command, it will usually be pulled in as a dependency by an ebuild.

If installing external software on Gentoo that requires GTK, write an ebuild to manage the installation of that software with it's GTK dependency.

GTK-2 and GTK-3

GTK-2 and GTK-3, are provided by the x11-libs/gtk+ package.

Some applications may optionally be built with support for a GTK interface when enabling the gtk USE flag.

There are also gtk2 and gtk3 USE flags.

USE flags

USE flags for x11-libs/gtk+ Gimp ToolKit +

+X Add support for X11
+introspection Add support for GObject based introspection
aqua Include support for the Mac OS X Aqua (Carbon/Cocoa) GUI
broadway Enable the GDK Broadway backend
cloudproviders Enable GtkPlacesSidebar to access cloud services
colord Use x11-misc/colord for color management in printing
cups Add support for CUPS (Common Unix Printing System)
examples Install examples, usually source code
gtk-doc Build and install gtk-doc based developer documentation for dev-util/devhelp, IDE and offline use
sysprof Enable profiling data capture support using dev-util/sysprof-capture
test Enable dependencies and/or preparations necessary to run tests (usually controlled by FEATURES=test but can be toggled independently)
vim-syntax Pulls in related vim syntax scripts
wayland Enable dev-libs/wayland backend
xinerama Add support for querying multi-monitor screen geometry through the Xinerama API

GTK-4

GTK-4 is provided by gui-libs/gtk, a separate package.

The gtk4 USE flag is provided by packages that have optional GTK-4 support.

USE flags

USE flags for gui-libs/gtk GTK is a multi-platform toolkit for creating graphical user interfaces

+X Add support for X11
+introspection Add support for GObject based introspection
aqua Include support for the Mac OS X Aqua (Carbon/Cocoa) GUI
broadway Enable the GDK Broadway backend.
cloudproviders Enable GtkPlacesSidebar to access cloud services
colord Use x11-misc/colord for color management in printing
cups Add support for CUPS (Common Unix Printing System)
examples Install examples, usually source code
ffmpeg Enable ffmpeg/libav-based audio/video codec support
gstreamer Add support for media-libs/gstreamer (Streaming media)
sysprof Enable profiling data capture support using dev-util/sysprof-capture
test Enable dependencies and/or preparations necessary to run tests (usually controlled by FEATURES=test but can be toggled independently)
vulkan Add support for 3D graphics and computing via the Vulkan cross-platform API
wayland Enable dev-libs/wayland backend

Additional software

  Important note to editors
This section currently is just a stub with a few examples of packages, please complete it with more useful content.

Search packages.gentoo.org for packages to use with GTK, such as themes or language bindings.

Themes

Development tools

Language bindings

Configuration

The following programs can be used to change the appearance of applications using the GTK toolkit:

  • lxde-base/lxappearance - part of the LXDE desktop environment, works for GTK 2 apps also (dark theme). Or manually edit ~/.gtkrc-2.0

User dark theme

GTK 3

FILE ~/.config/gtk-3.0/settings.ini
[Settings]
gtk-application-prefer-dark-theme = true

GTK 4

FILE ~/.bashrc
export GTK_THEME=Adwaita-dark

System-wide dark theme

GTK 3

FILE /etc/gtk-3.0/settings.ini
[Settings]
gtk-application-prefer-dark-theme = true

Troubleshooting

Mouse scrolling doesn't work

With the gtk-3 applications under fvwm or other window manager / desktop environments, mouse scrolling sometime doesn't work as it should or at all. At the same time, it work with the applications using other toolkit environments like Qt, which imply this is not a system or Xorg configuration issue. To fix that issue, to add the following environmental variable should work, as example:

FILE ~/.bashrc
export GDK_CORE_DEVICE_EVENTS=1

For more information, see GTK applications (sometimes?) do not scroll correctly, lacks focus?.

See also

External resources