macosrusttauri

How to add menu to user's right click tauri rust?


I am trying to add a menu option to the user's right-click menu for a mac app using tauri rust. I can't find any docs on this. Is it possible to add an option to the user's right-click? For example, when they select a file, our option should show up, like "Change the wallpaper."

for ex: enter image description here

Update:

After some research, I found that this is possible with Finder Sync Extensions, but I have no idea how to integrate it with Rust Tauri.

https://developer.apple.com/library/archive/documentation/General/Conceptual/ExtensibilityPG/Finder.html


Solution

  • Adding a custom menu option to the user's right-click menu on mac isn't currently possible through tauri's core functionalities.

    Integrating a Finder sync extension with a Tauri Rust application requires a workaround, but it's possible, as I have done so for a custom option to copy file paths when right-clicking on files(couldn't get it working for folders for some reason)

    Here is the method I followed:

    1. I created a standalone Mac application that is designed for the Finder Sync extension, and I added the functionality for the custom option.

    2. Then create a way for our Tauri application to communicate with the extension, there are a few ways to do this:

    1. Use notify or tokio to watch modification to that file.

    2. Parse the data, extract and perform the functionality through our Tauri app.

    You might have to update your UI accordingly.