How can the Default Applications command line be changed

I have Default Applications for the Browser set to “Firefox”. The problem is that when I use a link from KDE anywhere it creates a redundant, new Firefox window. I’d much prefer the URL to go to a tab in the existing browser. I think the way to get that is for the command to change from

firefox <url>

to

firefox --new-tab <url>

I’ve tested the new-tab option from the command line and it makes all the difference. But the “Default Applications” in “System Settings” has no apparent way to add arguments, all you get is the checkbox for “Run in terminal” and even that is from using the “Other” option.

So is there some way to maybe edit a config file to get “firefox %u” to slip in the new-tab option?

So then I got the idea to change the Web Browser to something obscure, then search ~/.config for any file having the obscure value. So “dillo” as browser pointed out the magic file is ~/.config/mimeapps.list by searching for “dillo” in ~/.config

grep dillo *

x-scheme-handler/http=dillo.desktop;
x-scheme-handler/https=dillo.desktop;
x-scheme-handler/http=dillo.desktop;
x-scheme-handler/https=dillo.desktop;

At least pointing out the file that matters for this. But since those are “*.desktop” files, I suspect changing that requires having overrides for those for the “Exec=” line

UPDATE: I think I have the workaround, I simply copied

/usr/share/applications/org.mozilla.firefox.desktop to ~/.local/share/applications/

and edited the Exec in the “[Desktop Entry]” section to be:

Exec=firefox --new-tab %u

and tried a URL from a Konsole man page and it seemed to work (the URL using the konsole “Open Link” menu opened to a tab in my existing Firefox instance instead of a new window).

So is this the ‘best’ way?

You can right click on the launcher icon and select “Edit Applications” and edit from there if you want.

However, all it does is the same thing you already did by hand.

That being said, opening in the existing Firefox window as a new tab should happen by default without you having to do that…

That being said, opening in the existing Firefox window as a new tab should happen by default without you having to do that…

It’s possible it’s a side effect of my running Firefox usually from multiple Desktop icon launchers because I have multiple profiles. One for “banking”, one for “default”, one for “privacy" (hardened for sites I consider phishing risky) and so on. But I do know that with the new overriding firefox desktop file the OS URLs (like from Konsole, man pages, etc) are finally working correctly and not making a new window.

Thanks

1 Like