Quick Example
Rtop let you create plugin for adding custom widgets. Firstly, create a new project:
cargo new --lib MyPlugin
After that, update your Cargo.toml file. It should look like that:
[]
= "MyPlugin"
= "0.1.0"
= "2021"
[]
= "^0.2.0"
[]
= "my_plugin"
= ["dylib"]
Then, edit your src/lib.rs to have somethings like this:
pub extern "Rust"
To build your lib, simply run:
cargo build --lib --release
Your plugin should be located here target/release/libmy_plugin.so.
Remember these things, For each widget you want to create, you must make a function called init_{WIDGET} which return a Box<dyn rtop_dev::plugin::Plugin and a bool that defines if your widget should receive input from the user or not.
Don't forget to add #[no_mangle] in front of each init function. Otherwise, it will not be exported