tray-item-rs icon indicating copy to clipboard operation
tray-item-rs copied to clipboard

set label

Open brandonros opened this issue 2 years ago • 4 comments

brandonros avatar Mar 01 '22 19:03 brandonros

@olback any reason why this isn't working? also not sure how to update the title (if we do get this call working) after we call .display because it seems to block the whole thread with no way to issue a callback/event?

brandonros avatar Mar 01 '22 20:03 brandonros

@brandonros I have found a way to make it work: https://github.com/Leksat/tray-item-rs/commit/980f0d2db45e97580ee77a961c2a87a9780b1cb1 Basically, we need to update the title on the status bar, not on the menu nor on the menu item.

Leksat avatar Sep 04 '22 12:09 Leksat

after we call .display because it seems to block the whole thread

In my fork, the .display is not blocking. Yet I'm struggling to change the menu label from a Tauri event listener. Getting error[E0277]: `*mut objc::runtime::Object` cannot be sent between threads safely. My Rust knowledge is very very limited to solve this puzzle 😬

Leksat avatar Sep 04 '22 12:09 Leksat

error[E0277]: *mut objc::runtime::Object cannot be sent between threads safely

I solved this by

  • adding unsafe impl Send for TrayItem {} to my tray-item-rs fork (commit)
  • using UnsafeCell to pass the TrayItem variable to a Tauri event handler (code)

Leksat avatar Sep 12 '22 06:09 Leksat