Introduction to GTK 4
The GTK 4 package contains libraries used for
creating graphical user interfaces for applications.
This package is known to build and work properly
using an LFS 12.4 platform.
Package Information
Download (HTTP): https://download.gnome.org/sources//gtk/4.20/gtk-4.20.3.tar.xz
Download SHA256 Sum: 2873f2903088a66c71173ea2ed85ffae266a66b972c3a4842bbb2f6f187ec153
Download MD5 sum: 7fe0499e3390d516f8644411ce2c3cde
Download size: 93,695.4 KB
Estimated disk space required: 838,974.4 KB
Estimated build time: 3.98 SBU
GTK 4 Dependencies
Required
gdk-pixbuf-2.44.4,
graphene-1.10.8,
ISO Codes-4.19.0,
libepoxy-1.5.10,
librsvg-2.61.3,
libxkbcommon-1.13.0,
Pango-1.57.0,
PyGObject-3.54.5, and
wayland-protocols-1.45
Recommended
adwaita-icon-theme-49.0 (runtime,
default for some gtk4 settings keys),
gst-plugins-bad-1.26.9,
glslc from shaderc-2025.4,
gst-plugins-good-1.26.9 (runtime,
built with libvpx-1.15.2),
hicolor-icon-theme-0.18 (needed for tests and for defaults), and
Vulkan-Loader-1.4.328.1
Recommended (Required if building GNOME)
GLib-2.86.2 (with GObject Introspection)
Optional
Colord-1.4.8,
"cups",
docutils-0.22.3,
Kernel Configuration
Some GTK-4 features need the following options in the kernel
configuration. It's also needed by the test suite.
Device Drivers --->
DMABUF options --->
[*] userspace dmabuf misc driver [UDMABUF]Installation of GTK 4
Prepare GTK 4 by running the following
commands:
meson setup build --prefix=/usr \
--buildtype=release \
-D broadway-backend=true \
-D introspection=enabled \
-D vulkan=enabledninja -C build
Now Install, the package as the root user:
ninja -C build install
Command Explanations
--buildtype=release: Specify a buildtype
suitable for stable releases of the package, as the default may
produce unoptimized binaries.
-D broadway-backend=true: This switch enables the
HTML5 GDK backend.
-D introspection=enabled: This switch enables
using GObject Introspection to generate GIR bindings
of this packages. These bindings are required by GNOME.
-D cloudproviders=enabled: Use this switch if you have
"libcloudproviders" installed and wish to
enable support for cloud providers in a file chooser window.
-D tracker=enabled: Use this switch if you have
"tinysparql" installed and wish to use search functionality
when running a file chooser.
-D colord=enabled: Use this switch if you have
Colord-1.4.8 installed and wish to use colord with the CUPS
printing backend.
-D man-pages=true: Use this switch if you have
docutils-0.22.3 installed and wish to generate the man
pages.
-D sysprof=enabled: Use this switch if you have
sysprof installed and wish to enable
tracing support for GTK4-based applications.
-D vulkan=disabled: Use this switch instead of
-D vulkan=enabled if you don't have
Vulkan-Loader-1.4.328.1 or glslc from shaderc-2025.4 installed.
It will disable the Vulkan backend that the upstream prefers to use
on Wayland-based graphical environments.
LIBGL_ALWAYS_SOFTWARE=1
and VK_LOADER_DRIVERS_SELECT='lvp*': Force the test
suite to use the softpipe or llvmpipe Gallium driver and the lavapipe
Vulkan driver from Mesa. The test suite is so sensitive that the
minor differences caused by a different Mesa driver can trigger test
failures.
env -u{GALLIUM_DRIVER,MESA_LOADER_DRIVER_OVERRIDE}:
Unset variables which may conflict with
LIBGL_ALWAYS_SOFTWARE=1.
--no-suite=headless: Disable
the tests requiring the external dependency pydbus.
Configuring GTK 4
Config Files
~/.config/gtk-4.0/settings.ini and
/usr/share/gtk-4.0/settings.ini
Configuration Information
GTK 4 themes change the way a
GTK 4 application looks. An icon theme can
be used to change the icons that appear on the application's toolbar.
If you have installed a GTK 4 theme (e.g.
the Adwaita theme built in GTK 4),
an icon theme (such as "oxygen-icons") and/or a font
(dejavu-fonts-ttf-2.37), you can set your preferences in
~/.config/gtk-4.0/settings.ini, or the default
system-wide configuration file (as the root user), in
/usr/share/gtk-4.0/settings.ini. For the local
user, an example is:
mkdir -pv ~/.config/gtk-4.0
cat > ~/.config/gtk-4.0/settings.ini << "EOF"
[Settings]
gtk-theme-name = Adwaita
gtk-icon-theme-name = oxygen
gtk-font-name = DejaVu Sans 12
gtk-cursor-theme-size = 18
gtk-xft-antialias = 1
gtk-xft-hinting = 1
gtk-xft-hintstyle = hintslight
gtk-xft-rgba = rgb
gtk-cursor-theme-name = Adwaita
EOF
There are many settings keys, some with default values. You can find them at
Settings: GTK 4 Reference Manual.
Contents
Installed Programs:
gtk4-broadwayd,
gtk4-builder-tool,
gtk4-demo,
gtk4-demo-application,
gtk4-encode-symbolic-svg,
gtk4-image-tool,
gtk4-launch,
gtk4-node-editor,
gtk4-path-editor,
gtk4-print-editor,
gtk4-query-settings,
gtk4-rendernode-tool,
gtk4-update-icon-cache, and
gtk4-widget-factory
Installed Libraries:
libgtk-4.so
Installed Directories:
/usr/include/gtk-4.0,
/usr/lib/gtk-4.0, and
/usr/share/gtk-4.0
Short Descriptions
gtk4-broadwayd |
provides support for displaying GTK 4 applications in a web
browser using HTML5 and web sockets
|
gtk4-builder-tool |
performs various operations on GtkBuilder .ui files
|
gtk4-demo |
is a simple program that demonstrates some of the tasks that can be
done with GTK 4
|
gtk4-demo-application |
is a simple GTK 4 application which is useful for testing
|
gtk4-encode-symbolic-svg |
converts symbolic SVG icons into special PNG files. GTK 4 can load
and recolor these PNGs, just like original SVGs, but loading them
is much faster
|
gtk4-image-tool |
performs various operations on images, including comparisons,
conversions, listing information on the images, relabeling the
images, and showing the images
|
gtk4-launch |
launches an application using the given name. The name should match
the application .desktop file name (as seen in
/usr/share/applications),
with or without the '.desktop' extension
|
gtk4-node-editor |
is a utility to show and edit render node files. Such render
node files can be obtained e.g. from the GTK inspector
|
gtk4-path-tool |
performs various tasks on paths, including decompositions,
reversals, restrictions, rendering, displaying the path, and
listing information about the paths
|
gtk4-print-editor |
is a simple program to demonstrate printing using GTK 4
applications
|
gtk4-query-settings |
provides a complete listing of all settings related to GTK 4
|
gtk4-rendernode-tool |
performs various tasks on GTK render nodes, including benchmarks,
comparisons, extracting data URLs, displaying information about
the nodes, displaying the nodes, and taking screenshots of nodes
|
gtk4-update-icon-cache |
is an icon theme caching utility that creates mmap()able cache
files for icon themes
|
gtk4-widget-factory |
is a program to view GTK 4 themes and widgets
|
libgtk-4.so
|
contains functions that provide an API to implement graphical user
interfaces
|