-
Notifications
You must be signed in to change notification settings - Fork 20
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
Deeplink is not working on Linux/Ubuntu #20
Comments
@vijaygodhasara I'm not sure if electron is even supporting this on Linux - the doc is not very clear. Only mentions Windows and MacOS - https://www.electronjs.org/docs/api/app#appsetasdefaultprotocolclientprotocol-path-args |
@vijaygodhasara - it should work on Linux, I'll debug it in the next couple of days. |
Thanks, Once done let me know so I can check also this stuff on Linux/ubuntu as well. |
@vijaygodhasara - sorry it's taken so long. I did find the error and will have a fix out soon (I expect tomorrow). |
Is this now solved? The issue is still marked as open and no replies after this one. Thanks. |
@cedriking - unfortunately not. There are some mixed issues regarding app.setAsDefaultProtocolClient on Linux. I tested on Linux and was never able to get it working. I also posted to the electron slack group, never got a response. I'll dig deeper and respond back. |
I try this, and it works. The point is: desktop: # Define desktop elem
exec: myapp %u # Define Exec |
Thanks @yeefun - I'll see if we can incorporate. |
Sorry, I found it doesn't work in every Linux platform. |
@yeefun - thanks for letting me know. |
I think this is where the bug lies: electron-deeplink/src/index.ts Lines 145 to 154 in de4690f
Because if (!gotTheLock) {
app.quit();
} else {
const onDeepLink = (link) => {...};
app.on('second-instance', (_event: Event, args: string[]) => {
if (['darwin','win32'].includes(process.platform)) return; // This is properly handled by electron-deep-link
const [_executable, link] = args;
onDeepLink(link);
});
...
deepLink = new Deeplink({
app,
mainWindow,
protocol: 'myApp',
});
deepLink.on('received', onDeepLink);
} As a side note, it feels a bit like a leaky abstraction to pass in the MainWindow at all--in particular, I have several windows that I show and hide based on whether the user is logged in (and what deep link is called). So it's not always the case that that the mainWindow should be open on a 2nd instance, or when a deeplink is called. Since callers already receive the if (this.mainWindow.isMinimized()) {
this.mainWindow.restore();
}
this.mainWindow.focus(); That said, this is a breaking change, and not really related to this issue, so feel free to ignore. @glawson happy to throw up a PR to fix this if you'd like! |
@Joelkang - that would be awesome! |
@Joelkang - I wonder if you test it on Linux and it works? |
@yeefun yep, I did. In addition to the changes I made above, I had to make this additional change to my Electron Forge config: {
name: '@electron-forge/maker-deb',
config: {
options: {
// existing options ...
mimeType: ['x-scheme-handler/myApp'], // I added this
},
},
}, |
@Joelkang - I also did this, but it didn't work in every Linux platform. (BTW, I use electron-builder.) what your Desktop Entry looks like? |
Because the `open-url` and `open-file` events are macOS only, we still need to rely on the second-instance event handler for linux (in addition to win32). Fixes glawson#20
Because the `open-url` and `open-file` events are macOS only, we still need to rely on the second-instance event handler for linux (in addition to win32). Fixes glawson#20
Because the `open-url` and `open-file` events are macOS only, we still need to rely on the second-instance event handler for linux (in addition to win32). Fixes glawson#20
Because the `open-url` and `open-file` events are macOS only, we still need to rely on the second-instance event handler for linux (in addition to win32). Fixes glawson#20
@glawson: Whenever you're ready! (Woops sorry should've checked first before forcepushing so many times.) @yeefun unfortunately I'm not trying to fix this for all linuxes--as long as it works on ubuntu, i'm good (though it doesn't seem like it shouldn't work on any other flavour). Here's the desktop file generated from electron-forge:
|
🎉 This issue has been resolved in version 1.0.9 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Deeplink is not working on Linux/Ubuntu.
Installed and integrated plugin into our electron project.
open on chrome with :
Open app
getting below error
![linux_deeplink_issue](https://user-images.githubusercontent.com/11735224/96600706-d7726380-130e-11eb-8b84-495e40fedda2.png)
The text was updated successfully, but these errors were encountered: