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

Support protocol deep linking on Linux #627

Closed
jasonblais opened this issue Oct 17, 2017 · 4 comments
Closed

Support protocol deep linking on Linux #627

jasonblais opened this issue Oct 17, 2017 · 4 comments

Comments

@jasonblais
Copy link
Contributor

Support protocol deep linking on Linux by adding MimeType entry into Mattermost.desktop file. http://archive.is/8C3zb

We'll need to confirm whether electron-builder adds it for .deb packages as well.

Note: This PR added support for Windows and Mac: #616

@dunkla
Copy link

dunkla commented Oct 2, 2018

Well, the following worked for me:

diff --git a/resources/linux/create_desktop_file.sh b/resources/linux/create_desktop_file.sh
index 2c1cd3b..aa1159e 100755
--- a/resources/linux/create_desktop_file.sh
+++ b/resources/linux/create_desktop_file.sh
@@ -14,5 +14,6 @@ Terminal=false
 Type=Application
 Icon=${FULL_PATH}/icon.svg
 Categories=Network;InstantMessaging;
+MimeType=x-scheme-handler/mattermost;
 EOS
 chmod +x Mattermost.desktop
diff --git a/src/main.js b/src/main.js
index eca0ec9..6b1b57c 100644
--- a/src/main.js
+++ b/src/main.js
@@ -180,7 +180,7 @@ const trayImages = (() => {
 if (app.makeSingleInstance((commandLine/*, workingDirectory*/) => {
   // Protocol handler for win32
   // argv: An array of the second instance’s (command line / deep linked) arguments
-  if (process.platform === 'win32') {
+  if (process.platform === 'win32' || process.platform === 'linux') {
     // Keep only command line / deep linked arguments
     if (Array.isArray(commandLine.slice(1)) && commandLine.slice(1).length > 0) {
       setDeeplinkingUrl(commandLine.slice(1)[0]);
@@ -423,7 +423,7 @@ app.on('ready', () => {
   }
 
   // Protocol handler for win32
-  if (process.platform === 'win32') {
+  if (process.platform === 'win32' || process.platform === 'linux') {
     // Keep only command line / deep linked argument. Make sure it's not squirrel command
     const tmpArgs = process.argv.slice(1);
     if (

@amyblais amyblais added the Hackfest null label Jan 25, 2019
@amyblais
Copy link
Member

Jira ticket for tracking: https://mattermost.atlassian.net/browse/MM-14092.

@hanzei
Copy link
Contributor

hanzei commented Feb 11, 2019

Hey @dunkla,

Would you be open to providing a PR with this changes? Would appreciate this.

@amyblais amyblais changed the title Linux: Support protocol deep linking [Help Wanted] Linux: Support protocol deep linking Feb 27, 2019
@amyblais amyblais removed the Hackfest null label Mar 1, 2019
@amyblais amyblais removed this from the Unscheduled milestone Jun 21, 2019
@amyblais amyblais added the Hacktoberfest null label Oct 7, 2019
@hanzei hanzei changed the title [Help Wanted] Linux: Support protocol deep linking Support protocol deep linking on Linux Oct 22, 2019
@amyblais amyblais removed the Hacktoberfest null label Nov 4, 2019
@jespino jespino added the Hacktoberfest null label Sep 21, 2020
@jespino jespino removed the Hacktoberfest null label Jan 14, 2021
@cpanato cpanato added the Hacktoberfest null label Oct 2, 2021
@devinbinnie
Copy link
Member

This works now :)
One note: Firefox won't always treat our deep links correctly if you put them in the address bar, but clicking on them works fine.

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

No branches or pull requests

7 participants