Setting google-chrome-stable as default browser

I switched to BSPWM a couple of days ago and have had an absolute blast. I installed Google Chrome using yay -S google-chrome and from what I can gather it installed the binary google-chrome-stable. When Google Chrome opened it gave me the option to set as default. When I pressed yes the terminal showed the following error.

xdg-settings: $BROWSER is set and can't be changed with xdg-settings

I did some digging and came across this thread Google Chrome default issue

I edited the file using sudo nano ~/.config/mimeapps.list and added the following to the config

[Default Applications]
text/html=google-chrome-stable
x-scheme-handler/http=google-chrome-stable
x-scheme-handler/https=google-chrome-stable
x-scheme-handler/about=google-chrome-stable
x-scheme-handler/unknown=google-chrome-stable

After restarting I noticed that when I try to use GH CLI from authentication it keeps on opening Firefox instead of Google Chrome.

If anyone can lend some insight, it would be a great help.

After some more investigation I found that the XDG was correctly set, and the issue is stemming from github-cli (2.15.0-1) from what I can assume it being from not respecting the XDG defaults. Due to my beginner knowledge, I am taking a stab in the dark here. In any case, I was able to resolve the issue by copy and pasting the opened URL from Firefox and moving it into chrome.

https://man.archlinux.org/man/xdg-settings.1

        xdg-settings get default-web-browser
        xdg-settings set default-web-browser google-chrome.desktop
1 Like

I attempted to run this in the terminal and it returned the following.

xdg-settings: $BROWSER is set and can't be changed with xdg-settings

Have you googled this message?

What does
xdg-settings get default-web-browser
say?

1 Like

Hmm I re opened the sudo nano ~/.config/mimeapps.list cleared the file and repasted what was in the guide in the original link. Now it reads google-chrome.desktop . I am going to try to log out and log back in to see if the command gh auth login opens chrome by default via terminal.

xdg-settings get default-web-browser

google-chrome.desktop

I think that this issue might be related to github-cli because vscode opened Google chrome by default. It seems to be when trying to open links from within the terminal that are opening in FireFox. The message I am seeing is

Press Enter to open github.com in your browser... 
[GFX1-]: glxtest: VA-API test failed: failed to initialise VAAPI connection.
ATTENTION: default value of option mesa_glthread overridden by environment.
ATTENTION: default value of option mesa_glthread overridden by environment.
ATTENTION: default value of option mesa_glthread overridden by environment.
ATTENTION: default value of option mesa_glthread overridden by environment.
Missing chrome or resource URL: resource://gre/modules/UpdateListener.sys.mjs

This might be outside the scope of what the original topic was on, and I appreciate the help. I am going to try to dig a little deeper to see if there is something I need to do in the terminal to fix this behavior.

As a side note: there is no need to use sudo for editing the files under the home directory. All the files in there should belong to your user and thus no reason for root privilege. Using root for these files might lead to ownership issues and consequently troubles down the road.

1 Like

Thank you for the guidance. I am still very new to all this, so I take any advice with the utmost appreciation.

2 Likes

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.