KDE applications (and others) opening google-chrome instead of the default firefox

Duncan 1i5t5.duncan at cox.net
Tue Sep 21 04:10:48 BST 2021


Daniel Sonck posted on Wed, 08 Sep 2021 14:26:42 +0200 as excerpted:

> For quite some time I have the annoying issue where all HTTP links (from
> KDE applications like Kontakt but also non-KDE applications like
> IntellIJ) have been opening in Google Chrome. This was set to the
> default application at some point, but for quite some time, I used the
> System Settings to set the default application web browser to firefox.
> 
> I'm currently wondering what decides under a full KDE environment which
> program to open for URLs. Things I've already considered are:
> 
> - Default Applications in System Settings
> - File associations
> 
> So currently I'm at a loss why something decides Google Chrome should be
> the default, which is annoying since I'm logged in and most of my
> history is inside Firefox, and not in Chrome. Besides that Chrome
> sometimes has glitchy behavior so I rather avoid using it if I can.

FWIW I've had that problem before as well.  It took me awhile to get it 
all straightened out, but eventually I did.  Not sure I can really tell 
you what I did, but some hints:

* Looks like you already set the default app in system settings.  Is it 
staying as you set it or switching?  (Here, it stayed as I set it but 
things were ignoring it.)

* Ensure the browsers aren't automatically resetting it for you.  Since 
you want firefox, ensure it's set to always check that it's the default 
browser.  (Settings/preferences > General, Always check if Firefox is 
your default browser.)  And while there, if it's not, hit the make 
default button as well.

While I've never run chrome as it's proprietary, I switched to firefox 
from chromium, and as I said, had problems too.  It's no longer installed 
so I can't check where its default settings are, but you'll want to 
ensure that chrome/chromium is set *not* to make itself default.

Then quit both and start chrome/chromium, quit it again and start firefox, 
and ensure firefox still says it's the default.  If that's not sticking 
it's probably the browsers resetting it and if you can't make them stop 
you may need to get support from them.

* Test from krunner (kde/plasma's run dialog) and/or from the search 
entry in the app launcher (which at least in theory should do exactly the 
same thing that krunner would do).

Try multiple variants:

kde.org

www.kde.org

http://www.kde.org

https://kde.org

And for good measure try at least two domains as well, say google.com or 
yahoo.com, in all four variants.

The idea is to see if it's different and which ones are wrong.

* Similarly, from konsole, run xdg-open (xdg-utils package if it's not 
installed) with the four variants.  That tests the generic defaults.

* Check that the individual apps don't have a per-app preferred browser 
default, or that it's set to the system default (if the option is 
available) if so.  (Note that older apps from before xdg standards may 
have separate options such as "kde default", "gnome default", etc.  
They'll also typically have a few presets available, as well as an 
"other" option that lets you type in your own choice.)

* You mentioned checking file associations, but there's a similar 
protocols setting that AFAIK doesn't really have a GUI -- I /believe/ 
that's what the default app setting is supposed to affect but obviously 
it doesn't work in all cases.

Hopefully the above hints will be enough and you don't have to go 
manually messing with the protocol setting, but I had to.  Unfortunately, 
what I did there involved a bit of command line, grepping strings like 
"chrome" (for me chromium) in files and then manually editing them, 
basically messing around until it worked, so I can't really give you the 
best instructions.  If you're reasonably comfortable at the commandline 
you can probably take it from there, but if not... well, let's just hope 
the above hints work and you don't have to deal with this one.

* As an alternate approach to the just above, you can at least narrow 
down the problem by doing a bisect of the problem space.  I've used this 
technique for other problems, tho I used the grep-and-edit for this one.

The idea of a bisect is to incrementally halve the potential problem 
space multiple times until you narrow things down to a specific file or 
even line in a file.

First make a backup of you home dir in case you fat-finger the moves/
deletes below.

The best first step for a bisect of a problem like this is to try a clean 
user config, either setting up a new user temporarily, or moving your 
home dir elsewhere and starting with an empty/clean config, to see if the 
problem still occurs.  If it occurs with a clean user config then the 
problem must be at the system level.  If not, then you know the problem's 
somewhere in your user config.

Reset after each step, deleting the newly created dirs and files and 
moving the old ones back in place.

Second step, given that most modern config, including for plasma, is in 
the $XDG_CONFIG_HOME dir (normally ~/.config), try with your normal home 
dir but with that directory moved elsewhere.  The result will tell you 
whether the problem is in ~/.config or not.  If not, try $XDG_DATA_HOME 
(~/.local/share by default, IIRC).

Then, try with all the files in the dir moved elsewhere but all the 
subdirs left in place.

When you know it's the files (not subdirs) in a dir, try with half the 
files.  Then with a half of the problem half so a quarter, then 1/8... 
until you get down to a single file.

Once you have the file, open it in a text editor and see if it's plain 
text or not (kde/plasma settings are all plain text, but some other apps 
may have binary settings files).  Assuming it's a plain text ini-style 
file as most kde settings files are, you have a choice.  If it doesn't 
look like there's too much to lose in it you can just delete it and get 
defaults again.  Or you can continue, bisecting file sections.  Once you 
have the section you can either just wipe the entire section or continue. 
to bisect individual lines within the section, until you find the 
specific problem line and thus the individual setting.

This is a massive pain, especially the first time, but from experience, I 
can tell you you learn a *LOT*.  After the first 2-3 bisects, you'll have 
a feel for where things are, and will be able to skip several of the 
first steps, often picking the file or at least the group of files you 
think it is and starting from there.

* Finally, one last hint.  YMMV, but after beginning to deal with the 
browser thing here, I decided I wanted it to be easier the next time it 
happened.  So I set up a distinctively named script, "wb" (for web but 
without the e), that launched my browser of choice, and then set 
everything up to point to that script.  So the next time I switch 
browsers I can simply change the command in the script to point to the 
new browser.  I'll change it in the one place and be done. =:^)  
(Actually, I have a second one, wbn, that opens the link in a new window 
instead of a new tab in an existing window, as well.   But mostly I just 
type that one into krunner.)  Of course this one's more for people 
comfortable enough at the commandline to do that sort of thing...

-- 
Duncan - List replies preferred.   No HTML msgs.
"Every nonfree program has a lord, a master --
and if you use the program, he is your master."  Richard Stallman



More information about the kde-linux mailing list