ungoogled-software / ungoogled-chromium-archlinux

Arch Linux packaging for ungoogled-chromium
BSD 3-Clause "New" or "Revised" License
344 stars 38 forks source link

⚡️ Enhancement - Prevent setting as default Web Browser after update #260

Closed Rikj000 closed 8 months ago

Rikj000 commented 8 months ago

Issue Description

Since a recent update ungoogle-chromium-bin started setting itself as the default browser after each update (on KDE Plasma).

It quickly gets very annoying to always go to: Settings => Applications => Default Applications => Toggle Web browser back to what was manually configured before the update.

I already reported this here: https://aur.archlinux.org/packages/ungoogled-chromium-bin#comment-959023

Possible solutions

I did some digging and can present x3 possible solutions,
but I still have to monitor if they will stick after next update.

1. Disable policy DefaultBrowserSettingEnabled

By disabling the DefaultBrowserSettingEnabled policy,
we should be able to stop Chromium from ever attempting to set itself as default.

Sources:

Policy Description: Setting the policy to True has Google Chrome always check whether it's the default browser on startup and,
if possible, automatically register itself.
Setting the policy to False stops Google Chrome from ever checking if it's the default and turns user controls off for this option.

  1. Create the directory:
    sudo mkdir -p /etc/chromium/policies/managed/
  2. Create the policy file:
    sudo touch /etc/chromium/policies/managed/test_policy.json
  3. Edit the policy file:
    sudo nano /etc/chromium/policies/managed/test_policy.json
  4. Paste following contents and save:
    {
    "DefaultBrowserSettingEnabled": false
    }

2. Set --no-default-browser-check runtime flag

By setting the --no-default-browser-check runtime flag,
we should be able to stop Chromium from prompting to be set as the default browser

Runtime Flag Description: Disable the default browser check, do not prompt to set it as such

Sources:

  1. Open the chromium.desktop file:
    sudo nano /usr/share/applications/chromium.desktop
  2. Alter the Exec line and save:
    Exec=/usr/bin/chromium --no-default-browser-check %U

3. Set default_browser_infobar_last_declined to a high value

By altering default_browser_infobar_last_declined to a high value,
we should hopefully be able to stop Chromium from ever asking to be set as default.

Sources:

  1. Open the Preferences file
    nano /home/<username>/.config/chromium/Default/Preferences
  2. Alter the default_browser_infobar_last_declined value to 99999999999999999 and save

Environment

Software Version
Ungoogled Chromium 122.0.6261.94
KDE Plasma 5.27.10
Kernel 6.7.7-x64v2-xanmod1-1
Rikj000 commented 8 months ago

I'm guessing the issue is more KDE related :thinking: Since today the default Web Browser got reset back to ungoogled-chromium-bin again..

Even though ungoogled-chromium-bin has not / did not receive an update
since I've opened this issue / applied above described possible solutions.

networkException commented 8 months ago

Is this Plasma 6 specific perhaps? ah I only now saw the version

hm not sure if i can do anything here

Rikj000 commented 8 months ago

Closing this issue since I'm rather certain that it's KDE related by now.

45mg commented 7 months ago

I have this issue, and I'm not using KDE. It seems to reset itself to the default browser on startup.

Rikj000 commented 4 weeks ago

I think I finally resolved my issue by opening /home/<username>/.config/mimeapps.list,
and removing each occurrence of chromium.desktop;