#### Beyond Linux® From Scratch (systemd Edition) - Version 11.1

### Chapter 25. Graphical Environment Libraries

- Prev

  GTK+-3.24.31

- Next

  GTK Engines-2.20.2

- Up
- Home

# GTK-4.6.1

## 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-11.1 platform.

### Package Information

- Download (HTTP): https://download.gnome.org/sources/gtk/4.6/gtk-4.6.1.tar.xz

- Download (FTP): ftp://ftp.acc.umu.se/pub/gnome/sources/gtk/4.6/gtk-4.6.1.tar.xz

- Download MD5 sum: 8b492a5429652e82f32eacb90762ca20

- Download size: 22 MB

- Estimated disk space required: 431 MB (69 MB installed, add 10 MB for tests)

- Estimated build time: 1.0 SBU (using parallelism=4, add 0.2 SBU for tests)

### GTK 4 Dependencies

#### Required

FriBidi-1.0.11, gdk-pixbuf-2.42.6, graphene-1.10.6, ISO Codes-4.9.0, libepoxy-1.5.9, libxkbcommon-1.4.0, Pango-1.50.4, PyGObject-3.42.0, and wayland-protocols-1.25

#### Recommended

adwaita-icon-theme-41.0 (default for some gtk4 settings keys), gst-plugins-bad-1.20.0, gst-plugins-good-1.20.0 (runtime, built with libvpx-1.11.0), hicolor-icon-theme-0.17 (needed for tests and for defaults), and librsvg-2.52.6

#### Recommended (Required if building GNOME)

gobject-introspection-1.70.0

#### Optional

colord-1.4.6, Cups-2.4.1, FFmpeg-4.4.1 (built with libvpx-1.11.0), GTK-Doc-1.33.2, Highlight-4.1 (runtime, only used by gtk4-demo for syntax highlighting of demo source code), sassc-3.6.2, Tracker-3.2.1, gi-docgen, libcloudproviders, and vulkan

User Notes: https://wiki.linuxfromscratch.org/blfs/wiki/gtk4

## Installation of GTK 4

Install GTK 4 by running the following commands:

    mkdir build &&
    cd    build &&

    meson --prefix=/usr --buildtype=release -Dbroadway-backend=true .. &&
    ninja

To run the tests, issue: meson test --setup x11. If you are in a Wayland session, replace x11 with wayland. A few tests may fail.

Now, as the `root` user:

    ninja install

## Command Explanations

`--buildtype=release`: Specify a buildtype suitable for stable releases of the package, as the default may produce unoptimized binaries.

`-Dbroadway-backend=true`: This switch enables the HTML5 GDK backend.

`-Dcloudproviders=enabled`: Use this switch if you have libcloudproviders installed and wish to enable support for cloud providers in a file chooser window.

`-Dsysprof=enabled`: Use this switch if you have sysprof-3.42.1 installed and wish to enable tracing support for GTK4-based applications.

`-Dtracker=enabled`: Use this switch if you have Tracker-3.2.1 installed and wish to use search functionality when running a file chooser.

`-Dcolord=enabled`: Use this switch if you have colord-1.4.6 installed and wish to use colord with the CUPS printing backend.

`-Dgtk_doc=true`: Use this switch if you have GTK-Doc-1.33.2 installed and wish to generate the API reference documentation.

## 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-icons5-5.91.0) and/or a font (Dejavu fonts), 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-icon-browser, gtk4-launch, gtk4-print-editor, gtk4-query-settings, 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-icon-browser | is a utility to explore the icons in the current icon theme. It shows icons in various sizes, their symbolic variants when available, as well as a description of the icon and its context
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-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-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

Last updated on

- Prev

  GTK+-3.24.31

- Next

  GTK Engines-2.20.2

- Up
- Home