diff options
| author | Andreas Grois <andi@grois.info> | 2021-04-26 22:23:38 +0200 |
|---|---|---|
| committer | Andreas Grois <andi@grois.info> | 2021-04-26 22:23:38 +0200 |
| commit | b4341551960626fb892d2de785130ce14dec4754 (patch) | |
| tree | df9c357d06d8d0b38c174523c05e963e5a64e2fd /swaystatus-plugin | |
| parent | 94a8deabd176c07fbf825627cbbbdb3b95b85b15 (diff) | |
Add options: List plugins, and get plugin help.
This fixes the TODO document's notes about not being able to get help
for individual plugins, and about not having any means to list all
loadable plugins.
Diffstat (limited to 'swaystatus-plugin')
| -rw-r--r-- | swaystatus-plugin/src/lib.rs | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/swaystatus-plugin/src/lib.rs b/swaystatus-plugin/src/lib.rs index 1d2d22b..8a632cf 100644 --- a/swaystatus-plugin/src/lib.rs +++ b/swaystatus-plugin/src/lib.rs @@ -32,9 +32,13 @@ //! This is because loading plugins is by definition unsafe, and we need to make sure that nothing //! can exist beyond the symbols from the dynamic library. //! +//! For implementors of this interface the same limitations apply, however afaik there is no way to +//! enforce them. This means that you need to make sure that all additional threads you create are +//! joined before the `run()` method of the runnable returns, otherwise your code will crash. +//! //! ## Note on linkage: //! While you can't easily change how dependencies are linked into your plugin, you can choose to -//! dynamically link against the Rust standard library. For memory reasons I'd strongly recommend +//! dynamically link against the Rust standard library. For memory reasons I'd recommend //! to do so. The easiest way is to set rustc compiler flags using .cargo/config in the project. use erased_serde::serialize_trait_object; @@ -141,6 +145,11 @@ pub trait SwayStatusModule { ///This is used for the command line option to print a default configuration. ///Let it return your config with all defaults (including optional fields). fn get_default_config<'p>(&'p self) -> Box<dyn SwayStatusModuleInstance + 'p>; + + ///This method should print a short summary of how to use and how to configure your plugin. + ///This is the place to explain enum variants not present in your sample config, or info on + ///advanced features. + fn print_help(&self); } ///This is what `SwayStatusModuleInstance::make_runnable()` returns. The main function of your module. |
