#gtk4 #wayland #ffi #unsafe #gtk4-layer-shell

sys gtk4-layer-shell-sys

Unsave gir-generated FFI bindings for gtk4-layer-shell

3 unstable releases

0.1.2 Aug 4, 2023
0.1.1 Aug 4, 2023
0.0.2 Apr 12, 2023
0.0.1 Apr 12, 2023

#711 in GUI

Download history 39/week @ 2023-08-16 33/week @ 2023-08-23 40/week @ 2023-08-30 58/week @ 2023-09-06 59/week @ 2023-09-13 56/week @ 2023-09-20 46/week @ 2023-09-27 56/week @ 2023-10-04 76/week @ 2023-10-11 90/week @ 2023-10-18 93/week @ 2023-10-25 79/week @ 2023-11-01 88/week @ 2023-11-08 77/week @ 2023-11-15 100/week @ 2023-11-22 78/week @ 2023-11-29

353 downloads per month
Used in 5 crates (via gtk4-layer-shell)

MIT license

68 lines

maintenance-status: passively-maintained (as of 2022-10-01) dependabot status


gtk4-layer-shell-sys: Crate docs.rs dependency status


These are the unsafe FFI bindings for gtk4-layer-shell. They were automatically generated from its .gir file. You need to have gtk4-layer-shell installed on your system to use this crate. Because it is new, you probably have to build it from source. If you did that, you might also have to set the following two environment variables:

export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
export LD_LIBRARY_PATH=/usr/local/lib

This crate is GTK4 only. Checkout gtk-layer-shell-sys if you want the GTK3 version.


These are the unsafe bindings. You most likely want to use the safe wrapper.

Generating the bindings

Generating the bindings yourself is not necessary to be able to use it. If you want to do it anyways, here are the steps you can follow to generate the bindings yourself.

You need to have Rust, and Gtk4 and gtk4-layer-shell installed. Clone the repository AND the submodule "gir".

git clone --recurse-submodules -j8 https://github.com/pentamassiv/gtk4-layer-shell-gir.git
git pull --recurse-submodules
cd ./gtk4-layer-shell-gir

Then you need to install gir.

cd gir
cargo install --path .
cd ..

If you regenerate the binding, because you have a new version of the Gtk4LayerShell gir file, copy it into the gir files folder. Now you can generate, build and test the bindings.

export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
cd gtk4-layer-shell-sys # Needed when the lib is built from source
gir -o .       # Regenerate the bindings
cargo build    # Build the created bindings
cargo test     # Test the created bindings
cd ..

There should not have been any errors. If you do encounter an error complaining about the dox feature not being available for the gtk4 crate, you have to change the name of the gtk4 crate in the Cargo.toml file. You should now continue and generate the safe wrapper. If you want to learn more about gir, have a look at its repo or its book.

Maintenance status

This crate is just an unsafe wrapper for the C library so it is feature complete and not actively worked on. There are Github Actions keeping the dependencies up-to-date. If you encounter any problems, feel free to open a PR.


Pull requests are very welcome but please keep the maintenance status in mind.




~63K SLoC