commit ec1456fe729faf22e374824e420b9bfced6d45c3 Author: stoorps Date: Sat Apr 25 00:17:31 2026 +0100 Add Hello Plugin with settings pane and metadata diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..681d854 --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,11 @@ +[workspace] +resolver = "2" +members = ["plugins/ohn-plugin-hello"] + +[workspace.dependencies] +hotplug-meta = { path = "/Users/sam.storer/repos/hotplug/crates/hotplug-meta" } +hotplug-macros = { path = "/Users/sam.storer/repos/hotplug/crates/hotplug-macros" } +hotplug-build = { path = "/Users/sam.storer/repos/hotplug/crates/hotplug-build" } +inventory = "0.3" +gpui = "0.2" +ohn-ui-plugin = { path = "/Users/sam.storer/repos/devism/crates/ohn-ui-plugin" } diff --git a/index.json b/index.json new file mode 100644 index 0000000..f5b8cad --- /dev/null +++ b/index.json @@ -0,0 +1,17 @@ +[ + { + "id": "org.devism.hello-plugin", + "name": "Hello Plugin", + "description": "A greeting demo plugin for ohn — shows how to contribute a settings pane.", + "versions": [ + { + "version": "0.1.0", + "dependency_name": "ohn-plugin-hello", + "api_versions": { + "OhnUiPlugin": "1.0" + }, + "download_url": "https://github.com/stoorps/ohn-plugins/archive/refs/heads/main.tar.gz" + } + ] + } +] diff --git a/plugins/ohn-plugin-hello/Cargo.toml b/plugins/ohn-plugin-hello/Cargo.toml new file mode 100644 index 0000000..52fbd8a --- /dev/null +++ b/plugins/ohn-plugin-hello/Cargo.toml @@ -0,0 +1,13 @@ +[package] +name = "ohn-plugin-hello" +version = "0.1.0" +edition = "2024" + +[package.metadata.hotplug.api_versions] +OhnUiPlugin = "1.0" + +[dependencies] +ohn-ui-plugin = { workspace = true } +hotplug-meta = { workspace = true } +inventory = { workspace = true } +gpui = { workspace = true } diff --git a/plugins/ohn-plugin-hello/src/lib.rs b/plugins/ohn-plugin-hello/src/lib.rs new file mode 100644 index 0000000..45cd660 --- /dev/null +++ b/plugins/ohn-plugin-hello/src/lib.rs @@ -0,0 +1,74 @@ +use gpui::prelude::*; +use gpui::*; +use ohn_ui_plugin::{OhnUiPlugin, PluginSettingsPane, PluginSidePanel}; + +/// Hello Plugin — a minimal demo of contributing a settings pane via OhnUiPlugin. +#[derive(Default)] +pub struct HelloPlugin; + +impl hotplug_meta::PluginMeta for HelloPlugin { + fn id() -> &'static str { + "org.devism.hello-plugin" + } + fn name() -> &'static str { + "Hello Plugin" + } + fn version() -> &'static str { + env!("CARGO_PKG_VERSION") + } +} + +impl OhnUiPlugin for HelloPlugin { + fn settings_pane(&self) -> Option { + Some(PluginSettingsPane { + label: "Hello", + icon_name: "star", + build: std::sync::Arc::new(|_window, cx| cx.new(|_cx| HelloView).into()), + }) + } + + fn side_panel(&self) -> Option { + None + } +} + +ohn_ui_plugin::register_ohn_ui_plugin!(HelloPlugin); + +// --------------------------------------------------------------------------- +// Settings pane view +// --------------------------------------------------------------------------- + +struct HelloView; + +impl Render for HelloView { + fn render( + &mut self, + _window: &mut Window, + _cx: &mut Context, + ) -> impl IntoElement { + div() + .flex() + .flex_col() + .items_center() + .justify_center() + .gap(px(16.0)) + .p(px(40.0)) + .child( + div() + .text_size(px(28.0)) + .child("👋"), + ) + .child( + div() + .text_size(px(18.0)) + .font_weight(FontWeight::SEMIBOLD) + .child("Hello from the Hello Plugin!"), + ) + .child( + div() + .text_size(px(13.0)) + .text_color(gpui::rgb(0x888888)) + .child("This demo plugin was installed via the hotplug registry."), + ) + } +}