Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow registering an app as a file handler #918

Closed
ehhc opened this issue Aug 2, 2020 · 11 comments
Closed

Allow registering an app as a file handler #918

ehhc opened this issue Aug 2, 2020 · 11 comments

Comments

@ehhc
Copy link

ehhc commented Aug 2, 2020

Hey there,
i want to develope a simple editor with tauri. Currently i'm wondering how i can react on fileOpenEvents (resp. whether there are even such things..). In Electron i could do the following:
ipcRenderer.on('open-file', (e, url) => this.openFile(url));

Can you tell me what the corresponding tauri way is?
Thanks in advance

@TobiasTao
Copy link

did u mean file/directory selection dialog?

@ehhc
Copy link
Author

ehhc commented Aug 2, 2020

No... Imagen i've created my app (it's named 'myCoolApp'). Then i want to right click on a file on my desktop an select 'open with' -> myCoolApp. In that case, somehow the app (after started by the operation system) has to know what to do (in my case open the correct file). With electron you can register the above mentioned open-file-event-handler and react on the open action (by opening the file).
I want to do that with a tauri app

@TobiasTao
Copy link

maybe not support yet #544

@TobiasTao
Copy link

hope this can help you @ehhc

  1. add this in setup:
    image
  2. select 'open with' -> my-app
    image
  3. app will get args
    image

@nklayman nklayman changed the title [question] how can i react on fileOpen-Events Allow registering an app as a file handler Feb 25, 2021
@nklayman
Copy link
Member

I've updated the title to what I think more closely resembles your problem. If that does't seem accurate to you, let me know.

@WilliamVenner
Copy link
Contributor

@jolic
Copy link

jolic commented Mar 15, 2022

hope this can help you @ehhc

  1. add this in setup:
    [image]
  2. select 'open with' -> my-app
    [image]
  3. app will get args
    [image]

Could you please paste some code to see how it could be implemented?

@tauri-apps tauri-apps deleted a comment from jolic Mar 15, 2022
@JonasKruckenberg
Copy link
Member

Could you please paste some code to see how it could be implemented?

First of all, this is an old repo (2y), so many things about Tauri have changed in the meantime but the last comment before yours already has code snippets that show exactly how this can be archived. There is nothing new to add here.

@ehhc
Copy link
Author

ehhc commented Mar 16, 2022

@JonasKruckenberg i opend this issue some time ago. So -- at least for me -- it's not relevant anymore. I understand that it still might be relevant for others, but with the solution given by the comment of @WilliamVenner (#918 (comment)) it might be a good idea to close this issue. Should i do it? Or do you contributors want to do it (I'm not sure whether that matters for the githube issue workflow/statistics/whatever)..

@JonasKruckenberg
Copy link
Member

If this issue is solved for you then feel free to close this issue. One can always create a new issue after all.

@erguotou520
Copy link

I have the same demand for append right click to open with function to my Tauri app.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants