GTK
GTK is a toolkit for creating graphical user interfaces. It is part of the GNU Project and maintained by GNOME.
Installation
GTK-2 and GTK-3
For gtk-2 and -3, users can install the libraries with the following command:
root #
emerge --ask x11-libs/gtk+
Some applications may optionally be built with support for a GTK interface when enabling the gtk
USE flag.
Users may even choose to enable GTK support for all packages in /etc/portage/make.conf.
GTK-4
In Gentoo, Gtk-4 is provided by gui-libs/gtk, a separate package.
root #
emerge --ask gui-libs/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
gtk-application-prefer-dark-theme = true
GTK 4
export GTK_THEME=Adwaita-dark
System-wide dark theme
GTK 3
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?.