mirror of
https://github.com/tauri-apps/plugins-workspace.git
synced 2026-06-08 14:03:53 +02:00
docs(positioner): Update positioner readme to new tray api (#1041)
`on_system_tray_event` is now reworked into `on_tray_icon_event`
This commit is contained in:
@@ -51,12 +51,19 @@ First you need to register the core plugin with Tauri:
|
||||
`src-tauri/src/main.rs`
|
||||
|
||||
```rust
|
||||
use tauri::tray::TrayIconBuilder;
|
||||
|
||||
fn main() {
|
||||
tauri::Builder::default()
|
||||
.plugin(tauri_plugin_positioner::init())
|
||||
// This is required to get tray-relative positions to work
|
||||
.on_system_tray_event(|app, event| {
|
||||
tauri_plugin_positioner::on_tray_event(app, &event);
|
||||
.setup(|app| {
|
||||
TrayIconBuilder::new()
|
||||
.on_tray_icon_event(|app, event| {
|
||||
tauri_plugin_positioner::on_tray_event(app.app_handle(), &event);
|
||||
})
|
||||
.build(app)?;
|
||||
Ok(())
|
||||
})
|
||||
.run(tauri::generate_context!())
|
||||
.expect("error while running tauri application");
|
||||
|
||||
Reference in New Issue
Block a user