I like setting up a new operating system. For the most part. All is still fresh. But some things need to be exactly like they were before. For a while now I’ve been keeping a backup of my configuration files in a dotfiles repository. This helps me getting up and running fairly quickly. However, that’s only half the trick.

Setting up Ubuntu is tedious. It doesn’t do a good job of getting out of your way. Rather, it gets in your way. Changing some interface behavior or installing software is rarely obvious. What I found myself doing more than anything was hitting up a search engine.

“How to install $SOFTWARE on Ubuntu?

“How to stop Ubuntu from doing $THING?”

To help my future self, I created a text document in my home directory. In there, I wrote down what I did to answer these questions for myself. Following now is a loose collection of things I need to do when setting up a fresh Ubuntu installation.

Gnome Tweak Tool

sudo apt update
sudo apt install gnome-tweak-tool

General Settings

Global file associations for text files

Ubuntu uses gedit as its default text editor. To associate files that are opened in gedit with another program, one needs to adjust the file /usr/share/applications/defaults.list. Replace all occurences of gedit.desktop with the file name that is being associated with your preferred application. The new file name needs to refer to a file that exists in the same directory, e.g.:

sublime_text.desktop

code.desktop

vim.desktop

The following command replaces all occurences of gedit.desktop with code.desktop, thus making Visual Studio Code the default text editor in most cases.

If this did not work for a a certain file, it might not be covered by the entries in defaults.list or it might have been overriden previously. This happens when one changes the default application used for “Open With Other Application” from within the file explorer.

Luckily, these overrides can be controlled with a command-line interface. The following examples re-associate regular text files with Visual Studio Code.

Prints the current setting:

xdg-mime query default text/plain

Changes the association:

xdg-mime default code.desktop text/plain

Disable touchpad when mouse is connected

It puzzles me that this is not a setting available in System Settings. The following unfortunately is not very reliable. It also doesn’t communicate the touchpad state to System Settings.

Disable account locking when closing the laptops’ lid

Disable tab/application switching on scroll (not possible)

This one is not even configurable at all. This feature is very annoying to me, as use my mouse wheel to open links in a new tab very often. That also makes me switch tabs in Chrome by accident all the time when a slight turn of the wheel occures.

It’s not a good idea to use the mouse wheel turn for any kind of distinct interaction like switching a tab or navigating the browser history, as the metaphor is wrong. A wheel affords turning, adjusting values on a scale. In particular it’s well matched for smooth adjustments to a value (e.g. scrolling, zooming, controlling volume levels).