SUMMARY STEPS TO REPRODUCE 1. Have multiple desktops 2. Have Firefox in one virtual desktop and another Firefox in another 3. Focus one Firefox 4. Change to the other virtual desktop 5. Open a link OBSERVED RESULT It opens in Firefox of the inactive virtual desktop The green indicator in the taskbar appears (to pick between instances) when clicking it it shows both Firefox instances. Clicking the one where the link opens changes the virtual desktop. EXPECTED RESULT I would expect the link to open in the Firefox of the current virtual desktop since it's visible. Notes: I use 2 monitors, both Firefox are on the right monitor, I open links from applications in the left monitor. Operating System: KDE neon 5.16 KDE Plasma Version: 5.16.3 KDE Frameworks Version: 5.60.0 Qt Version: 5.12.3 Kernel Version: 4.18.0-25-generic OS Type: 64-bit Processors: 4 × Intel® Core™ i5-4690K CPU @ 3.50GHz Memory: 15,6 GiB of RAM
What app has the link that you're clicking on? Another web browser? Some KDE app?
Usually it's Hexchat, which is a GTK based desktop application.
Can you test with a KDE app? Every one has clickable links in Help > About KDE.
I tried with Konversation. Same thing, but here are some additional observation: Not sure exactly what happens, but if I click the link in Konversation, if the the Firefox in VD1 wasn't focused last, it opens it in the Firefox at VD2, as described. The weird thing is, subsequent clicks to the link open the Firefox in the correct (VD1) Firefox, even if I force focus the other one (at VD2) (This happens after closing whatever the link opened in in the Firefox in VD2 and focusing the Firefox in VD1 and then focusing on the Firefox on VD2 again before trying to click the link). As soon as I paste a fresh new link (im testing with Imgur image links), it will open it on VD2 Firefox if it was the last focused. Not sure if I'm explaining myself well.
Thanks for the info!
I also opened a bug in the Firefox bug tracker, since it might be a Firefox issue.
I hope this is a per-browser setting. I have configured my browser (Otter Browser) to open new windows instead of new tabs, and I don't want anything to override my decision.
I "guess" it'll have to be something that firefox upstream has to implement. This is based on how kate handles opening documents, by default if you have a kate instance running on the current virtual desktop it'll open the document in that instance. Otherwise it'll open the document in a new instance, even if you have a kate instance running on a different virtual desktop. What I want to say, it's most likely app-dependent. Upstream firefox doesn't, at the time of writing this, even support restoring windows from a firefox session to the virtual desktop that each window was open on[1]. https://bugzilla.mozilla.org/show_bug.cgi?id=372650
FWIW, you can work around the issue by making firefox open the url in a new window, which naturally will open on the current virtual desktop, instead of a tab in an already existing window by changing the default web browser to this command (systemsettings -> applications -> default applications -> web browser, "with the following command" lineedit box): /usr/bin/firefox --new-window
This isn't a KIO bug AFAICS; it falls to the individual apps to handle such issues. FWIW, here's a hacky bash script that I use to make firefox always open links on the current desktop: #!/bin/bash # get the current virtual desktop number currDesktopNum=$(wmctrl -d | grep -F "*" | cut -d' ' -f1) # get the title of any firefox window, if any exist, on the current desktop ffWinTitle=$(wmctrl -l | grep Mozilla\ Firefox | grep -F " "$currDesktopNum" " | perl -p -e 's!.+?\s+\d .+? ([/\w].+)!$1!') # if the title isn't empty, i.e. there's a firefox window on this desktop, raise that window # then call firefox --new-tab; otherwise call firefox --new-window if [ ! -z "$ffWinTitle" ]; then wmctrl -a "$ffWinTitle" /usr/bin/firefox --new-tab "$@" & else /usr/bin/firefox --new-window "$@" & fi
If someone stumbles upon this report, here's a better version of my puny script that uses window ID instead of relying on title (if you have two firefox windows with the same title on two different virtual desktops, it's playing a toss-up): #!/bin/bash # get the current virtual desktop number currDesktopNum=$(wmctrl -d | grep -F "*" | cut -d' ' -f1) # get the win id of any firefox window, if any exists, on the current desktop ffWinID=$(wmctrl -l | grep Mozilla\ Firefox | grep -F " "$currDesktopNum" " | head -n1 | perl -p -e 's!([\S]+).+!$1!') # if the win id isn't empty, i.e. there's a firefox window on this desktop, raise that window # then call firefox --new-tab; otherwise call firefox --new-window if [ ! -z "$ffWinID" ]; then wmctrl -i -a "$ffWinID" /usr/bin/firefox --new-tab "$@" else /usr/bin/firefox --new-window "$@" fi