| Crates.io | waybar-cffi-sys |
| lib.rs | waybar-cffi-sys |
| version | 0.1.1 |
| created_at | 2025-03-06 02:50:05.439566+00 |
| updated_at | 2025-03-06 16:47:00.426378+00 |
| description | Low level bindings used when creating a Waybar CFFI module |
| homepage | |
| repository | https://github.com/LawnGnome/waybar-cffi-rs |
| max_upload_size | |
| id | 1580428 |
| size | 30,633 |
waybar-cffiThis 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.
Creating and using a CFFI module is (relatively) easy.
Create a cdylib crate:
[package]
name = "my-module-name"
version = "0.1.0"
edition = "2024"
[lib]
crate-type = ["cdylib"]
[dependencies]
waybar-cffi = "0.1.0"
Implement the waybar_cffi::Module trait on a type, and use the
waybar_cffi::waybar_module macro 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 waybar per the CFFI instructions:
{
"modules-left": ["cffi/my-module-name"],
"cffi/my-module-name": {
"module-path": "target/debug/libmy_module_name.so"
}
}
Profit!
Refer to the waybar-cffi documentation for more details.
Honestly, I probably won't be devoting a tonne of time to this in the near future, but I'm definitely open to PRs.
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.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.
make hello-world will build the hello world
example and run Waybar with two instances
of it configured.