If you target a certain platform with your GUI, you will want to follow the platform's Human Interface Guidelines (HIG). With a GTK application, chances are the platform is either elementary OS or GNOME. In this chapter we will discuss how to follow GNOME's HIG with libadwaita.

Libadwaita is a library augmenting GTK 4 which:

  • provides widgets to better follow GNOME's HIG
  • provides widgets to let applications change their layout based on the available space
  • integrates the Adwaita stylesheet
  • allows runtime recoloring with named colors
  • adds API to support the cross-desktop dark style preference

In order to use the Rust bindings add the following line to your dependencies in Cargo.toml, where X.X should be replaced with the most up-to-date version of the libadwaita crate.

adw = { version = "X.X", package = "libadwaita" }

The versions of the gtk4 and libadwaita crates need to be synced. Just remember that when you update one of them to the newest version to update the other one as well.

Installation of the library itself works similar to GTK. Just follow the installation instruction that is suitable for your distribution.


Fedora and derivatives:

sudo dnf install libadwaita-devel

Debian and derivatives:

sudo apt install libadwaita-1-dev

Arch and derivatives:

sudo pacman -S libadwaita


brew install libadwaita


From the Windows start menu, search for x64 Native Tools Command Prompt for VS 2019. That will open a terminal configured to use MSVC x64 tools. From there, run the following commands:

cd /
git clone --depth 1
cd libadwaita
meson setup builddir -Dprefix=C:/gnome -Dintrospection=disabled -Dvapi=false -Dexamples=false
meson install -C builddir