I’m using Tauri and Tauri Plugin Positioner. I’ve setup as per documentation:
main.rs:
fn main() {
...
tauri::Builder::default()
.plugin(tauri_plugin_positioner::init()) <- Initialised plugin
.on_system_tray_event(|app, event| {
tauri_plugin_positioner::on_tray_event(app, &event); <- Required for tray locations
match event {
SystemTrayEvent::LeftClick { position: _, size: _, .. } => {
...
},
_ => {}
}
})
...
app.js from React frontend:
import { move_window, Position } from 'tauri-plugin-positioner-api'
function App () {
move_window(Position.TrayBottomRight)
...
I’ve also updated the cargo.toml file to include system-tray feature as that is apparently necessary:
tauri-plugin-positioner = { version = "1.0", features = ["system-tray"] }
I have tried it as ‘Rust only’ where the positioning is done through main.rs but it produced further errors.
The current error I am getting is:
thread 'tokio-runtime-worker' panicked at 'Tray position not set'
I have researched this but the documentation seems very limited. It seems to be mirrored from the Electron version, where they specify a traybounds argument in move_window(Position.TrayBottomRight, traybounds)
, but it errors as the argument is unexpected. My only thought is it is because of my .on_system_tray_event
setup, but I can’t figure out how to re-write it.
Can anyone point me in the right direction or spot what I’ve done wrong (fairly new to rust & tauri).