---
layout: post
title: "Chaging default browser for GNOME on Debian"
date: 2017-10-11 11:25:00 +0200
comments: true
categories: 
---

Problem position
================

I have `chromium` and `firefox-esr` installed. I want `gvfs-open`
to default to the latter when opening a web URL.

Alternatives
============

There are /etc/alternatives entries for `x-www-browser` and
`gnome-www-browser` that can be manually edited using

    # update-alternatives --config gnome-www-browser
    # update-alternatives --config x-www-browser

Unsuprisingly, this won't have the desired effect. Life
would be too simple...

GNOME MIME
==========

The default browser for GNOME applications is determined using
`gvfs-mime`. Per-user overrides can be specified in
`~/.local/share/applications/mimeapps.list`. System-wide
defaults are generated by `update-desktop-database` and
stored in `/usr/share/applications/mimeinfo.cache`.

Quoting https://wiki.debian.org/MIME:

> The mimeinfo.cache is basically a raw reverse cache for the
> .desktop information. There is no way to define priorities in it.
> To be able to specify default applications, a mimeapps.list file
> (previously named defaults.list up to debian 5) must be created.
> It can be system-wide (in /usr/share/applications or a subdirectory)
> or user-specific (in $HOME/.local/share/applications).

And indeed the fix was to reorder the list from `mimeinfo.cache`,
and create the following file:

```plain /usr/share/applications/mimeapps.list
[Default Applications]
x-scheme-handler/http=firefox-esr.desktop;chromium.desktop;google-chrome.desktop;
x-scheme-handler/https=firefox-esr.desktop;chromium.desktop;google-chrome.desktop;
```