waybar-cffi
This provides Rust bindings to create CFFI modules for Waybar.
Waybar CFFI modules are shared libraries that provide modules that can be included in a Waybar. These can use the full capabilities of Gtk 3 and, more generally, native code.
Quick start
Creating and using a CFFI module is (relatively) easy.
-
Create a
cdylibcrate:[] = "my-module-name" = "0.1.0" = "2024" [] = ["cdylib"] [] = "0.1.0" -
Implement the
waybar_cffi::Moduletrait on a type, and use thewaybar_cffi::waybar_modulemacro to export the required symbols. (See the hello world example or the documentation for more detail.) -
Build in the normal way with
cargo build. -
Configure
waybarper the CFFI instructions: -
Profit!
Refer to the waybar-cffi documentation for more details.
Development
Honestly, I probably won't be devoting a tonne of time to this in the near future, but I'm definitely open to PRs.
Layout
This workspace contains two crates:
waybar-cffi: the main entry point into the CFFI functionality.waybar-cffi-sys: the low level bindings based on the CFFI header.
Updating bindings
New Waybar versions will likely require the bindings to be updated. This can be
done by running make clean && make ffi WAYBAR_ROOT=path/to/Waybar.
Note that a full Waybar checkout is currently required as the CFFI header isn't shipped in the release packages.
Smoke tests
make hello-world will build the hello world
example and run Waybar with two instances
of it configured.