Crate everything_plugin

Crate everything_plugin 

Source
Expand description

Rust binding for Everything’s plugin SDK.

Features:

  • Load and save config with Serde
  • Make options pages GUI using Winio in MVU (Elm) architecture
  • Internationalization with rust-i18n
  • Log with tracing

§Example

mod options;

#[derive(Serialize, Deserialize, Debug, Default)]
pub struct Config {
    s: String,
}

pub struct App {
    config: Config,
}

impl PluginApp for App {
    type Config = Config;

    fn new(config: Option<Self::Config>) -> Self {
        Self {
            config: config.unwrap_or_default(),
        }
    }

    fn config(&self) -> &Self::Config {
        &self.config
    }

    fn into_config(self) -> Self::Config {
        self.config
    }
}

plugin_main!(App, {
    PluginHandler::builder()
        .name("Test Plugin")
        .description("A test plugin for Everything")
        .author("Chaoses-Ib")
        .version("0.1.0")
        .link("https://github.com/Chaoses-Ib/IbEverythingLib")
        .options_pages(vec![
            OptionsPage::builder()
                .name("Test Plugin")
                .load(ui::winio::spawn::<options::MainModel>)
                .build(),
        ])
        .build()
});

§Detachable design

The API is designed to allow the app to be easily detached from Everything and run independently. Either for standalone distribution or testing.

This also means a standalone Winio app can be relatively easily integrated into Everything as a plugin.

Components:

TODO:

  • Tray icon and menu itmes / tabs
  • Load & save config with file
  • Unified host/IPC API

§Build

§Static CRT

.cargo/config.toml:

[target.'cfg(all(target_os = "windows", target_env = "msvc"))']
rustflags = ["-C", "target-feature=+crt-static"]

Increase build size by ~100 KiB.

§Debugging

  • .\Everything64.exe -debug

    Unlike -debug, -debug-log doesn’t work with stdout/stderr outputs.

§Features

  • tracing (enabled by default) — Log with tracing

    TODO: Disable on release?

  • tracing-appender — Non-blocking logging

  • serde (enabled by default) — Load and save config with Serde

  • winio (enabled by default) — Make options pages GUI using Winio in MVU (Elm) architecture

  • winio-darkmode — Enable dark mode support in Winio

    1214 -> 1233 KiB

    TODO: Affect Everything labels, limit to thread local?

  • rust-i18n — Internationalization with rust-i18n.

    The locale name is the same as used by Windows, e.g. en-US. See OS Language Values-Codes for details.

Re-exports§

pub use everything_ipc as ipc;
pub use serde;

Modules§

data
Everything data directory:
log
macros
sys
Reference: https://www.voidtools.com/forum/viewtopic.php?t=16535
ui
Everything plugin SDK GUI API

Macros§

plugin_main

Structs§

PluginHandler
Example
PluginHandlerBuilder
Use builder syntax to set the inputs and finish with build().
PluginHost
instance_name (non-official) config_* db_* debug_* (tracing) localization_get_* os_enable_or_disable_dlg_item os_get_(local_)?app_data_path_cat_filename plugin_?et_setting_string property_* ui_options_add_plugin_page utf8_buf_(init|kill) version_get_*, plugin_get_version

Traits§

PluginApp
Example