GTK
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
Search packages.gentoo.org for packages to use with GTK, such as themes or language bindings.
Themes
- x11-themes/arc-theme - flat theme with transparent elements for GTK 2/3/4
Development tools
- Cambalache - RAD tool for GTK4 and GTK3
- dev-util/gnome-builder - Integrated Development Environment for GNOME
- dev-util/glade - RAD tool for GTK3, unmaintained
Language bindings
- dev-libs/gjs - Javascript bindings for GNOME
- dev-cpp/gtkmm - C++ interface for GTK
- dev-python/pygobject - Python bindings for GObject based libraries such as GTK
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
[Settings]
gtk-application-prefer-dark-theme = true
GTK 4
export GTK_THEME=Adwaita-dark
System-wide dark theme
GTK 3
[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:
export GDK_CORE_DEVICE_EVENTS=1
For more information, see GTK applications (sometimes?) do not scroll correctly, lacks focus?.
See also
- GNOME — a feature-rich desktop environment provided by the GNOME project.
External resources
- x11-libs/wxGTK - GTK version of wxWidgets, a cross-platform C++ GUI toolkit