I could reproduce this problem using 18.04.3 live CD using Slack and Atom. However, I don't think the problem is caused by snapd.
Slack, Skype and Atom are all classic snaps so they have full access to the system. With Slack installed, clicking on the 'get started' link was enough to get another Firefox window open. I collected the strace log. A relevant piece is here:
10782 execve("/usr/local/sbin/xdg-open", ["xdg-open", "https://slack.com/ssb/add"], 0xb6c9467b000 /* 75 vars */) = -1 ENOENT (No such file or directory)
10782 execve("/usr/local/bin/xdg-open", ["xdg-open", "https://slack.com/ssb/add"], 0xb6c9467b000 /* 75 vars */) = -1 ENOENT (No such file or directory)
10782 execve("/usr/sbin/xdg-open", ["xdg-open", "https://slack.com/ssb/add"], 0xb6c9467b000 /* 75 vars */) = -1 ENOENT (No such file or directory)
10782 execve("/usr/bin/xdg-open", ["xdg-open", "https://slack.com/ssb/add"], 0xb6c9467b000 /* 75 vars */) = 0
10784 execve("/usr/bin/which", ["which", "gnome-default-applications-prope"...], 0x560d5fb594a8 /* 75 vars */) = 0
10784 +++ exited with 1 +++
10782 --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=10784, si_uid=999, si_status=1, si_utime=0, si_stime=0} ---
10785 execve("/usr/bin/gio", ["gio", "help", "open"], 0x560d5fb594a8 /* 75 vars */) = 0
10785 +++ exited with 0 +++
10782 --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=10785, si_uid=999, si_status=0, si_utime=0, si_stime=0} ---
10786 execve("/usr/bin/gio", ["gio", "open", "https://slack.com/ssb/add"], 0x560d5fb594a8 /* 75 vars */) = 0
10789 +++ exited with 0 +++
10786 --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=10789, si_uid=999, si_status=0, si_utime=0, si_stime=0} ---
10790 execve("/usr/local/sbin/firefox", ["firefox", "https://slack.com/ssb/add"], 0x563485f1c6e0 /* 77 vars */) = -1 ENOENT (No such file or directory)
10790 execve("/usr/local/bin/firefox", ["firefox", "https://slack.com/ssb/add"], 0x563485f1c6e0 /* 77 vars */) = -1 ENOENT (No such file or directory)
10790 execve("/usr/sbin/firefox", ["firefox", "https://slack.com/ssb/add"], 0x563485f1c6e0 /* 77 vars */) = -1 ENOENT (No such file or directory)
10790 execve("/usr/bin/firefox", ["firefox", "https://slack.com/ssb/add"], 0x563485f1c6e0 /* 77 vars */) = 0
10791 +++ exited with 0 +++
Notice how slack attempts to run xdg-open (and does so successfully at some point), then it proceeds to run `gio open ..`, and again does that successfully, finally it just runs firefox with the URL. I believe this is what triggers the new window to appear.
Another observation for Slack on 18.04 is that gnome-shell groups the Firefox window *with* the slack one.
I tried diffing the environment between the inside and outside of snap:
However I could still spawn a separate Firefox window using a simple `gio open http://<url>`.
I've proceeded to install Chromium and set it to be my default browser. At this point all the links and xdg-open calls I tried would open a new tab in the current Chromium window.
Perhaps the problem is actually with Firefox and the method it uses to find out whether there's antoher instance already running.
I could reproduce this problem using 18.04.3 live CD using Slack and Atom. However, I don't think the problem is caused by snapd.
Slack, Skype and Atom are all classic snaps so they have full access to the system. With Slack installed, clicking on the 'get started' link was enough to get another Firefox window open. I collected the strace log. A relevant piece is here:
10782 execve( "/usr/local/ sbin/xdg- open", ["xdg-open", "https:/ /slack. com/ssb/ add"], 0xb6c9467b000 /* 75 vars */) = -1 ENOENT (No such file or directory) "/usr/local/ bin/xdg- open", ["xdg-open", "https:/ /slack. com/ssb/ add"], 0xb6c9467b000 /* 75 vars */) = -1 ENOENT (No such file or directory) "/usr/sbin/ xdg-open" , ["xdg-open", "https:/ /slack. com/ssb/ add"], 0xb6c9467b000 /* 75 vars */) = -1 ENOENT (No such file or directory) "/usr/bin/ xdg-open" , ["xdg-open", "https:/ /slack. com/ssb/ add"], 0xb6c9467b000 /* 75 vars */) = 0 "/usr/bin/ which", ["which", "gnome- default- applications- prope". ..], 0x560d5fb594a8 /* 75 vars */) = 0 "/usr/bin/ gio", ["gio", "help", "open"], 0x560d5fb594a8 /* 75 vars */) = 0 "/usr/bin/ gio", ["gio", "open", "https:/ /slack. com/ssb/ add"], 0x560d5fb594a8 /* 75 vars */) = 0 "/usr/local/ sbin/firefox" , ["firefox", "https:/ /slack. com/ssb/ add"], 0x563485f1c6e0 /* 77 vars */) = -1 ENOENT (No such file or directory) "/usr/local/ bin/firefox" , ["firefox", "https:/ /slack. com/ssb/ add"], 0x563485f1c6e0 /* 77 vars */) = -1 ENOENT (No such file or directory) "/usr/sbin/ firefox" , ["firefox", "https:/ /slack. com/ssb/ add"], 0x563485f1c6e0 /* 77 vars */) = -1 ENOENT (No such file or directory) "/usr/bin/ firefox" , ["firefox", "https:/ /slack. com/ssb/ add"], 0x563485f1c6e0 /* 77 vars */) = 0
10782 execve(
10782 execve(
10782 execve(
10784 execve(
10784 +++ exited with 1 +++
10782 --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=10784, si_uid=999, si_status=1, si_utime=0, si_stime=0} ---
10785 execve(
10785 +++ exited with 0 +++
10782 --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=10785, si_uid=999, si_status=0, si_utime=0, si_stime=0} ---
10786 execve(
10789 +++ exited with 0 +++
10786 --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=10789, si_uid=999, si_status=0, si_utime=0, si_stime=0} ---
10790 execve(
10790 execve(
10790 execve(
10790 execve(
10791 +++ exited with 0 +++
Notice how slack attempts to run xdg-open (and does so successfully at some point), then it proceeds to run `gio open ..`, and again does that successfully, finally it just runs firefox with the URL. I believe this is what triggers the new window to appear.
Another observation for Slack on 18.04 is that gnome-shell groups the Firefox window *with* the slack one.
I tried diffing the environment between the inside and outside of snap:
--- in-shell 2019-10-17 13:43:59.474529198 +0000 IM_MODULE= xim truecolor BUS_ADDRESS= unix:path= /run/user/ 999/bus SESSION= ubuntu OUTPUT= stderr TOPICS= JS ERROR;JS LOG DESKTOP_ SESSION_ ID=this- is-deprecated SHELL_SESSION_ MODE=ubuntu TERMINAL_ SCREEN= /org/gnome/ Terminal/ screen/ 113b5986_ bfcc_47c1_ 8317_a37a7600b3 96 TERMINAL_ SCREEN= /org/gnome/ Terminal/ screen/ d399bea3_ fa8f_4330_ 842a_0eaaac4395 33 TERMINAL_ SERVICE= :1.143 INFO=/run/ user/999/ gnupg/S. gpg-agent: 0:1 MANAGER= local/ubuntu: @/tmp/. ICE-unix/ 4000,unix/ ubuntu: /tmp/.ICE- unix/4000 /var/snap/ atom/common yBpkxSLRYnnStMx l74JWW8f6GLLQDX lD6qC2rdmXVjsh yBpkxSLRYnnStMx l74JWW8f6GLLQDX lD6qC2rdmXVjsh /var/snap/ atom/238 NAME=atom PATH=/var/ lib/snapd/ lib/gl: /var/lib/ snapd/lib/ gl32:/var/ lib/snapd/ void snap/atom/ 238 COMMON= /home/ubuntu/ snap/atom/ common DATA=/home/ ubuntu/ snap/atom/ 238 1.40.1 SOCK=/run/ user/999/ keyring/ ssh 256color DIRS=/etc/ xdg/xdg- ubuntu: /etc DESKTOP= ubuntu: GNOME DIRS=/usr/ share/ubuntu: /usr/local/ share:/ usr/share: /var/lib/ snapd/desktop PREFIX= gnome- DIR=/run/ user/999 DIR=/run/ user/999/ snap.atom DESKTOP= ubuntu
+++ in-snap-shell 2019-10-17 13:44:09.186624002 +0000
@@ -2,13 +2,14 @@ CLUTTER_
COLORTERM=
DBUS_SESSION_
DESKTOP_
+DISABLE_WAYLAND=1
DISPLAY=:0
GDMSESSION=ubuntu
GJS_DEBUG_
GJS_DEBUG_
GNOME_
GNOME_
-GNOME_
+GNOME_
GNOME_
GPG_AGENT_
GTK_IM_MODULE=ibus
@@ -27,7 +28,22 @@ QT_ACCESSIBILITY=1
QT_IM_MODULE=ibus
SESSION_
SHELL=/bin/bash
-SHLVL=1
+SHLVL=2
+SNAP_ARCH=amd64
+SNAP_COMMON=
+SNAP_CONTEXT=
+SNAP_COOKIE=
+SNAP_DATA=
+SNAP_INSTANCE_KEY=
+SNAP_INSTANCE_
+SNAP_LIBRARY_
+SNAP_NAME=atom
+SNAP_REEXEC=
+SNAP_REVISION=238
+SNAP=/
+SNAP_USER_
+SNAP_USER_
+SNAP_VERSION=
SSH_AGENT_PID=4095
SSH_AUTH_
TERM=xterm-
@@ -43,7 +59,7 @@ XDG_CONFIG_
XDG_CURRENT_
XDG_DATA_
XDG_MENU_
-XDG_RUNTIME_
+XDG_RUNTIME_
XDG_SEAT=seat0
XDG_SESSION_
XDG_SESSION_ID=2
However I could still spawn a separate Firefox window using a simple `gio open http://<url>`.
I've proceeded to install Chromium and set it to be my default browser. At this point all the links and xdg-open calls I tried would open a new tab in the current Chromium window.
Perhaps the problem is actually with Firefox and the method it uses to find out whether there's antoher instance already running.