diff --git a/komorebi-client/src/lib.rs b/komorebi-client/src/lib.rs index 7cb3365a..dd1104a9 100644 --- a/komorebi-client/src/lib.rs +++ b/komorebi-client/src/lib.rs @@ -1,4 +1,5 @@ pub use komorebi::DATA_DIR; +pub use komorebi::Notification; pub use komorebi::core::ApplicationIdentifier; pub use komorebi::core::MoveBehaviour; pub use komorebi::core::OperationBehaviour; diff --git a/komorebi/src/core/mod.rs b/komorebi/src/core/mod.rs index 55b170d3..4dd7e8d5 100644 --- a/komorebi/src/core/mod.rs +++ b/komorebi/src/core/mod.rs @@ -403,7 +403,7 @@ pub enum SocketMessage { // AddSubscriberPipe(String), // RemoveSubscriberPipe(String), ApplicationSpecificConfigurationSchema, - // NotificationSchema, + NotificationSchema, SocketSchema, StaticConfigSchema, // GenerateStaticConfig, diff --git a/komorebi/src/process_command.rs b/komorebi/src/process_command.rs index af17531b..603cd6f9 100644 --- a/komorebi/src/process_command.rs +++ b/komorebi/src/process_command.rs @@ -1422,6 +1422,15 @@ impl WindowManager { reply.write_all(schema.as_bytes())?; } } + SocketMessage::NotificationSchema => { + #[cfg(feature = "schemars")] + { + let notification = schemars::schema_for!(Notification); + let schema = serde_json::to_string_pretty(¬ification)?; + + reply.write_all(schema.as_bytes())?; + } + } SocketMessage::SocketSchema => { #[cfg(feature = "schemars")] { diff --git a/komorebic/src/main.rs b/komorebic/src/main.rs index e8f09229..1b19e894 100644 --- a/komorebic/src/main.rs +++ b/komorebic/src/main.rs @@ -1087,7 +1087,7 @@ enum SubCommand { #[clap(alias = "asc-schema")] ApplicationSpecificConfigurationSchema, /// Generate a JSON Schema of subscription notifications - // NotificationSchema, + NotificationSchema, /// Generate a JSON Schema of socket messages SocketSchema, /// Generate a JSON Schema of the static configuration file @@ -1710,6 +1710,14 @@ fn main() -> eyre::Result<()> { println!("{schema}"); } } + SubCommand::NotificationSchema => { + #[cfg(feature = "schemars")] + { + let notification = schemars::schema_for!(komorebi_client::Notification); + let schema = serde_json::to_string_pretty(¬ification)?; + println!("{schema}"); + } + } SubCommand::SocketSchema => { #[cfg(feature = "schemars")] {