9

No matter what I change, my xfce4-terminal will not use chrome as the browser, and keeps opening firefox windows.

tim@MushaV3 ~ $ grep 'html' ~/.config/mimeapps.list 
text/html=google-chrome.desktop;
application/x-extension-html=exo-web-browser.desktop;
application/x-extension-shtml=exo-web-browser.desktop;
application/x-extension-xhtml=google-chrome.desktop;
application/xhtml+xml=google-chrome.desktop;
text/html=google-chrome.desktop
application/x-extension-html=google-chrome.desktop
application/x-extension-shtml=google-chrome.desktop
application/x-extension-xhtml=google-chrome.desktop
application/xhtml+xml=google-chrome.desktop

Both exo-open https://forums.gentoo.org and xdg-open https://forums.gentoo.org opens the url, in the current window, in chrome but opening a url directly from the terminal causes it to open in firefox.

Can anyone spread some light on where terminal is getting this from?

4 Answers 4

14

Had this issue multiple times, and this approach solved it for me:

Here's how you can check your current configuration and see what options you have (the names you should use might vary depending on your system):

gio mime x-scheme-handler/http

Then, you can change the default adding the option you want as an extra argument (you probably need to set both http and https):

gio mime x-scheme-handler/http google-chrome.desktop
gio mime x-scheme-handler/https google-chrome.desktop

Source: https://russellstinnett.com/2018/01/26/really-really-setting-default-browser-xfce/

1
  • Perfect, this is exactly what fixed it for me as well. Commented Dec 5, 2022 at 20:41
2

I found the answer, almost by chance.

In my ~/.config/mimeapps.list file I have two sections defined:

[Added Associations] and [Default Applications]

I found that while at some point my settings had been put into [Added Associations], they were missing the semi-colon at the end of each line. I may of added this manually in the past, and until recently this had worked. Seemingly an update has changed the handling of this config file.

I instead removed my edited lines and added them to the [Default Applications] section of the file, and now everything is working as expected.

1
  • 1
    You should also check $HOME/.local/share/applications/defaults.list. Commented Mar 8, 2021 at 23:10
0

In ~/.config/mimeapps.list:

[Default Applications]
x-scheme-handler/http=vivaldi-stable.desktop
x-scheme-handler/https=vivaldi-stable.desktop

Also, be sure to delete any similar handlers under the [Added Associations] section of this configuration file.

0

In my case, I'm pretty sure some evil application (todoist) keeps editing my mimeapps.list, so I wrote the following script that I run in my .bashrc to fix it every time I open my terminal:

#!/usr/bin/python3
import sys
import os

try:
  mimeapps_list = open(f"{os.environ['HOME']}/.config/mimeapps.list", "r+")
except FileNotFoundError as fnfe:
  print(fnfe, file=sys.stderr)
  sys.exit(1)

data = mimeapps_list.readlines()
for i in range(len(data)):
  line = data[i]
  if "text/html=" in line:
    data[i] = "text/html=brave-browser.desktop"
    if ";" in line:
      data[i] += ";"
    data[i] += "\n"

mimeapps_list.seek(0)
mimeapps_list.write("".join(data))
mimeapps_list.truncate()
mimeapps_list.close()

Of course, you may need to tweak this if you are having trouble with something other than the "text/html" entry.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .