Skip to content

A library to create panels and other desktop components for Wayland using the Layer Shell protocol and GTK4

License

Notifications You must be signed in to change notification settings

ainola/gtk4-layer-shell

 
 

Repository files navigation

GTK4 Layer Shell

GTK4 Layer Demo screenshot

A library for using the Layer Shell Wayland protocol with GTK4. With this library you can build desktop shell components such as panels, notifications and wallpapers. You can use it to anchor your windows to a corner or edge of the output, or stretch them across the entire output. This Library is compatible with C, C++ and any language that supports GObject introspection files (Python, Vala, etc).

Documentation

GTK3 version

Supported Desktops

This library only works on Wayland, and only on Wayland compositors that support the Layer Shell protocol. Layer shell is supported on:

  • wlroots based compositors (such as Sway)
  • KDE Plasma on wayland
  • Mir-based compositors (some may not enable the protocol by default. It can be enabled with --add-wayland-extension zwlr_layer_shell_v1)

Layer shell is not supported on:

  • Gnome-on-Wayland
  • Any X11 desktop

Using the Library

Demo

gtk4-layer-demo is built if examples are enabled. It's useful for testing layer shell support in compositors. Its code can be found in examples/demo/.

C/C++

The easiest way to build against GTK Layer Shell is to use the gtk-layer-shell-0 pkg-config package. Refer to your build system or the pkg-config docs for further instructions. examples/simple-example.c is a minimal complete app written in C. If you link against libwayland, you must link libwayland after gtk4-layer-shell. See linking.md for details.

Python

examples/simple-example.py contains sample Python code.

Vala

examples/vala-standalone contains a minimal working standalone Vala project, see the readme for details.

Rust

@pentamassiv maintains safe Rust bindings and the crates.io crate. Rust examples can be found here.

Distro Packages

List of distros GTK Layer Shell is packaged for

Building From Source

  1. Clone this repo
  2. Install build dependencies (see below)
  3. $ meson setup -Dexamples=true -Ddocs=true -Dtests=true build
  4. $ ninja -C build
  5. $ sudo ninja -C build install
  6. $ sudo ldconfig

Build Dependencies

To install these dependencies on Ubuntu 18.04 and later:

sudo apt install meson libwayland-dev libgtk-4-dev gobject-introspection libgirepository1.0-dev gtk-doc-tools valac

Meson Options

  • -Dexamples (default false): If to build the example C apps; gtk4-layer-demo is installed if examples are built; The Vala example is never built with the rest of the project
  • -Ddocs (default false): If to generate the docs
  • -Dtests (default false): If to build the tests
  • -Dintrospection (default: true): If to build GObject Introspection data (used for bindings to languages other than C/C++)
  • -Dvapi (default: true): If to build VAPI data (allows this library to be used in Vala). Requires -Dintrospection=true

Running the Tests

  • ninja -C build test

Licensing

100% MIT (unlike the GTK3 version of this library which contained GPL code copied from GTK)

About

A library to create panels and other desktop components for Wayland using the Layer Shell protocol and GTK4

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C 85.2%
  • Python 8.6%
  • Meson 6.2%