desktop icon indicating copy to clipboard operation
desktop copied to clipboard

Support protocol deep linking on Linux

Open jasonblais opened this issue 7 years ago • 3 comments

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: https://github.com/mattermost/desktop/pull/616

jasonblais avatar Oct 17 '17 17:10 jasonblais

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 (

dunkla avatar Oct 02 '18 15:10 dunkla

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

amyblais avatar Feb 11 '19 16:02 amyblais

Hey @dunkla,

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

hanzei avatar Feb 11 '19 16:02 hanzei

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.

devinbinnie avatar May 05 '23 15:05 devinbinnie