blog · git · desktop · images · contact & privacy · gopher


Browser tooling

History

It all started with me wanting to synchronize my Firefox settings across my computers. “Firefox Sync” was not an option because it depends on a third party service. You can install the “Mozilla Weave” service on your own server, but that was complicated and buggy at the time (around 2012).

Plus, I already had most of my config files for other programs in a Git repo, so why not just add Firefox?

I tried and it worked. I even included settings like icon positions.

Important detail: I never wanted to synchronize the session, like history or open tabs. I only cared about the browser’s settings.

Turns out, this is a cumbersome task. Firefox touches and rewrites many files while running. Firefox updates often change “everything”. At one point, I got so frustrated that I wrote lariza, but that’s not the answer, either, because “The Web” “just sucks” and WebKit can’t quite cope with that suckiness.

Over time, though, this whole endeavor led me to more minimalism. I cared less and less about certain configuration options, like icon positions, hotkeys, or theming. Just use the browser’s defaults. This makes everything a little easier.

Current state

What I want from a browser today is this:

That’s my “main browser”. The one, that runs all day.

Occasionally, I want to open another browser window which is completely independent from the main browser.

So, here are the tools that help me do this. It’s not perfect and it’s a little convoluted. It’s certainly not “the answer”, either – because the answer would be something like lariza with Gecko or Blink as a rendering engine. Maybe, one day, with the help of Qt5 and QtWebEngine, we’ll get that.

browser-wrapper

To avoid hard-coding any particular browser, I use this:

Pretty simple.

cleanfox

This is the heart of it all:

It creates a “fresh profile” with some basic settings and makes Firefox use that profile. When Firefox exits, the profile will be destroyed.

With cleanfox, I get one temporary Firefox. Launching two of them is fine, too.

cleanfox-session

Always destroying the profile can be annoying. That’s why there’s cleanfox-session:

It uses a fixed path and inhibits removing it.

Note that this script still uses a directory in “/tmp” to store the profile. I like it that way. On each boot, I get a perfectly clean browser profile.

This is “the main browser”.

The same for Chromium

Occasionally, I want to run a clean instance of Chromium. From time to time, I even switch to Chromium completely because it offers better performance than Firefox (at the cost of some other annoyances). I can do that easily by changing “~/.browser”.

So, here’s the same thing for Chromium:

Looks almost the same.

Adblock and other add-ons

Usually, browser add-ons are installed in the profile itself. That holds true for Firefox and Chromium. As my profile gets created and destroyed all the time, this is kind of a problem.

Luckily, both browsers support installing extensions on a system-wide basis. This means I can simply install packages like this:

This makes adblock available and I never have to care about it again.

For Chromium, there is a similar mechanism, see branch private/chromium-extension-adblockpro in my arch-packages repo.

This doesn’t install the add-on itself, but only puts an “autoinstall” file on the system which then tells Chromium to install the add-on at runtime.

Keyword searching and bookmarks

Note that none of the above includes support bookmarks and keyword searching. You know, typing “yt foobar” into your browser and it searches for “foobar” on YouTube. This is very, very useful.

All browsers have native support for both of these features. Of course they do. But maintaining settings for keyword searching is really annoying. Why? Because Firefox and Chromium have a “rich feature set” regarding keyword searching (other people would say they are “bloated”). Chromium even stores these settings in an sqlite database.

I used a “bookmarks.xhtml” for a long time. I wrote that file manually, which was fine. Problem is: How do you open it? Do you open it as the “new tab page”? Then you have to configure settings for new tabs – assuming the browser lets you customize that. Do you open it using a global hotkey that simply launches “browser-wrapper bookmarks.xhtml”? That’s one option.

The whole issue can be worked around by moving “the input line of the browser” out of the browser. There you go:

It uses dmenu or rofi or whatever. You can search bookmarks, use keyword searching, or open URLs directly. Pretty much the same as the browser’s bultin input line.

Password management

I never used bultin password managers of the browsers, so this was not a big issue to begin with. I simply use this:

It works with pretty much everything, including Lynx or VNC sessions.

Conclusion

As already explained, this is not the perfect solution. But it’s an improvement. I gain a little more independence from one particular browser.

And a big plus: This is a lot easier to sync and maintain than anything I had before. I try to keep the browsers “dumb”, so there are not that many browser settings to worry about in the first place.