1. Overview
Like other operating systems, Linux provides us with the flexibility to choose our preferred Web browser. Notably, setting a system-wide default browser enables a smooth and uniform browsing experience across multiple applications.
In this tutorial, we’ll configure our preferred browser as the default for our entire system. To be specific, we’ll work in the GNOME desktop environment.
2. Using the Graphical User Interface
To begin with, we access the GNOME settings. For that, we click on the Activities button in the top-left corner of the screen. Once it’s open, let’s type in Settings and click on the settings icon that appears.
Next, we find and click on the Default Applications tab in Settings. To elaborate, this is where system-wide preferences for various applications are defined:
Now, under Default Applications, let’s locate the Web label. Here, we get access to a dropdown menu listing all available Web browsers installed on our system.
So, once we click on the dropdown, we get a list of browsers from which we can select. In our case, we’ll set Google Chrome as the default browser:
Above, we select Google Chrome, and the changes update automatically.
Now, GNOME should use Google Chrome as the default to handle all web-related activities like opening web links.
3. Using the Command Line
Alternatively, we can use the command line to set our system-wide default Web browser.
In particular, we can set Google Chrome by using the xdg-settings tool:
$ xdg-settings set default-web-browser google-chrome.desktop
So, let’s break down this command:
- set: xdg-settings subcommand allows the manipulation of a specific desktop setting
- default-web-browser: represents the desktop setting we want to manipulate
- google-chrome.desktop: indicates the name of the Desktop file for the desired default browser
To elaborate, Desktop files define shortcuts for applications and can usually be found under the /usr/share/applications/ directory.
In summary, the command above instructs our system to use Google Chrome when opening Web links from applications or the command line.
To illustrate, let’s open a web link from the command line:
$ xdg-open https://www.google.com/chrome/
In this example, the xdg-open command opens the specified URL using the default web browser. As expected, it opens the Google Chrome download page.
4. Conclusion
In this article, we saw that configuring a system-wide browser is fairly straightforward both from the graphical user interface and from the command line using xdg-settings. Therefore, we can choose either approach based on our preference.
Additionally, setting a default Web browser can be crucial for a smooth workflow. This is because it ensures a consistent and user-friendly web experience across multiple applications.