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

[feat] Adding file association functionality. #3736

Closed
sprout2000 opened this issue Mar 19, 2022 · 14 comments
Closed

[feat] Adding file association functionality. #3736

sprout2000 opened this issue Mar 19, 2022 · 14 comments

Comments

@sprout2000
Copy link

Describe the problem

At this time, I can't double-click or right-click on a file to launch an app.

Describe the solution you'd like

I would like to be able to configure file associations via tauri.config.json.

Alternatives considered

No response

Additional context

No response

@FabianLars
Copy link
Member

FabianLars commented Mar 19, 2022

For reference and some hints: #918.

Edit: You can keep this issue open since the other one's closed without being generally resolved.

@mantou132
Copy link

mantou132 commented Jul 2, 2022

Some simple research:

Window: registry + launch args
macOS: info.plist + callback

@MunsMan
Copy link

MunsMan commented Apr 19, 2023

Are there any updates? I'm currently pretty new to tauri and still learning a lot, but I can't figure out how to open files with my app selected for opening it. I added a CLI which opens the first parsed file and I have a button to open files. But when I open a document with macOS, I get the error that my app doesn't support PDF. Sadly, displaying PDF is its only purpose. I would love some help or a hind in the right direction.

@amrbashir amrbashir moved this to 📋 Backlog in Roadmap Apr 24, 2023
@wusyong wusyong moved this from 📋 Backlog to 📬Proposal in Roadmap Apr 29, 2023
@jzillmann
Copy link

I asked for a related feature here: https://discord.com/channels/616186924390023171/1110215400047784058 and got forwarded to this ticket.

In my case I want to open files with my tauri app (text editor) through the terminal. E.g. with open -a /Users/jz/MyProject.app ~/Desktop/sidebar.svg, but got the same no supported message.

Screen Shot 2023-05-22 at 16 38 37

@billyjacoby
Copy link

billyjacoby commented May 23, 2023

Hmm I'm running into this exact issue now and can't seem to figure out how to get around it. I was hoping that one of the args passed in to the application when opened would be the file path, but that doesn't seem to be the case.

Any thoughts on how to get the file path for the file that was clicked to open the Tauri app?

I've tried using env::args_os() and env::args() but neither of them seem to include any relevant information.

@qu1ck
Copy link

qu1ck commented Jun 15, 2023

Windows can have file associations through wix/nsis templates.
Linux can have them through deb.desktopTemplate.
Should MacOS bundle support injecting custom plist file?

@SFCMN
Copy link

SFCMN commented Jul 10, 2023

Hope to support this feature soon, it's a very common requirement for most file-viewing programs

@tnrich
Copy link

tnrich commented Sep 7, 2023

@lucasfernog I'm not seeing file associations within the tauri docs. Should this issue actually be closed yet? Seems like it hasn't fully made it in?

@lucasfernog
Copy link
Member

It's a v2 feature and it isn't documented yet @tnrich.

@lorenzolewis do we have a place we're tracking pending features to be documented?

@lorenzolewis
Copy link
Member

Thanks @lucasfernog and @tnrich ! I've created an issue to track here: tauri-apps/tauri-docs#1526

For anything else that we need to track to be documented feel free to add an issue in that repo and link any respective PRs.

@lucasfernog I use https://github.com/tauri-apps/tauri-docs/milestone/4 as the to-do list so if you can just make sure any issues are added to that milestone that gets it on the official™️ list.

@eugenehp
Copy link
Contributor

eugenehp commented May 3, 2024

Just adding this here as a reference: https://github.com/tauri-apps/tauri/tree/dev/examples/file-associations (windows and linux)

for Mac – use tauri-plugin-deep-link

@ryusei-48
Copy link

I realize that this approach is a good way to get the TAURI program started for the first time, but is there a sample like Electron's open-file event that would allow a running TAURI program to receive notification and get the file path when the associated file is double-clicked while the TAURI program is running?

@martpie
Copy link

martpie commented Sep 29, 2024

To double down on what @ryusei-48 said, it seems this peculiar behavior works well on macOS thanks to the Opened event, but I cannot manage to make things work the same for Linux/Windows.

Combining things with the single-instance plugin makes things even more cryptic.

@qu1ck
Copy link

qu1ck commented Sep 30, 2024

@martpie The way this is usually implemented is to open a pipe/socket on the first instance of the app and when OS launches another instance because user double clicked a file in explorer then the new instance tries to open the same pipe/socket, fails, sends the path to the first instance that is listening on the pipe/socket and then exits.

That's how I did it in my tauri app too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

No branches or pull requests