How I run Social Apps in Firefox

Mina's Profile

Posted on Saturday, 30 May 2020 by Mina Galić

A long time ago I stopped using Chrome. And then Electron showed up. It seemed like a very convinient way to run all these Social Apps. Tools like Franz and Rambox seemed like a good way to contain them.

Running more than one browser under restricted memory conditions (8GiB) was problematic: It was impossible to run VSCode and Franz / Rambox at the same time. Starting Firefox before one of these would lock up all tabs, making the… browser browser effectively useless.

I needed to change something.

Let’s back up here, what’s the problem with Electron (other than using off all my memory and killing off my browser)?

Electron isn’t just Chrome. It’s also NodeJS. That means it doesn’t just give you access to the Internet, it also has full access to your filesystem. And that means if the programmers of Discord mess up somewhere, they could wipe your filesystem. That cannot happen if you’re just using discord as pure Web Application.

Running multiple different Electron Applications on the same memory-restricted systems means that your OS cannot even do the bare-minimum of only loading the shared libraries once for multiple running instances. This is because each one of those application has its own release-cycle and as such, very different bundled versions of shared libraries.

The memory issues, and the security risks combined gave me the push to look for alternatives.

Firefox has a couple of features that all combined allow to do what Rambox / Franz do, without having to run Electron:

and the fact that we’re usning just a single version of Firefox means the OS can optimise loading of shared libraries of your multiple instances.


So, how do we do this?

We’ll create a fresh profile, and call it “social”

% firefox --ProfileManager

and create a “Desktop” entry in ~/.local/share/applications/social.desktop to make it easily accessible:

[Desktop Entry]
Comment=Social Media Profile for Firefox
GenericName=Web Browser
Exec=firefox -P social %u

This creates us an empty profile and makes it accessible via application menues under the name “social”.

The most important line here is:

Exec=firefox -P social %u

But Name= and Comment= make it easy to find in menus.

From here, we need to install a couple of useful plugins. I don’t use any browser without uBlock Origin.

For what we need to accomplish, we’ll also need Firefox Multi-Account Containers. If you’re using Twitter, or Facebook or LinkedIn or others, they have specialized container addons.

What these addons do is capture all known URLs of a service to guarantee that they are opened in the dedicated container. The containers are session and cookie barriers, and since we’re planning to run every service in a dedicated container there’s no cross-pollination… or poisoning happening.

Let’s do it!

We can now start adding service by service, making sure each is running in a dedicated container with a nice colour we like. Once the setup (well, sign-up, really) is complete, we can pin the tab:

A crop of the pinned tabs of my setup, showing 13 of them

We now start using our social Firefox. As we do, we’ll notice that we keep wanting to open links in our regular browser, or vice-versa.

Firefox Sync

And we can use Firefox Sync to do that! By making our social profile its own Firefox Sync “device”, we can easily send links from and to these devices:

Firefox Context Menus, pointing at Send to Device and showing available devices

If you take care about naming your devices, sending links can become a very quick action. From the keyboard, [Send Link to Device] is under n.

Note that Firefox Sync allows you to very fine-tune what to sync, and for this profile, I chose to sync nothing.

Reducing Surface

One of the goals of this project was to provide an “appliance” feeling, for that purpose it’s necessary to reduce the surface and streamline the experience:

uBlock’s Settings allows to disable its context menu entry:

We can disable Pocket. We can do that in about:config by setting extensions.pocket.enabled to false

That gets rid of the Context Menu Item [Save Link to Pocket].

We can also disable Developer Tools, by setting everything in devtools.*.enable to false.

That gets rid of two Context Menu Items: [Inspect Accessibility Properties] and [Inspect (Q)].

That is seemed all that was possible for now, so for the future, I opened two bugs for further slimming down Firefox:

But it turns out that we can disable Private Browsing. Let’s go ahead and modify our .desktop file to add an environment variable to the startup:

Exec=env XPCSHELL_TEST_PROFILE_DIR=1 firefox -P social %u

And before we restart, we an already modify about:config to add a string parameter, browser.policies.alternatePath, which we’ll point at our policies.json. I put mine into the profile folder itself, and filled it with:

  "policies": {
    "DisablePrivateBrowsing": true

After restarting our “social” Firefox, the context menu now looks like:

Firefox context menu after clicking on a Link, There is no longer an "Open Link in New Private Window" item

You can take a look at the other policies for what you might want to disable in your profile.

If you find more ways of slimming down Firefox, or improving experience I’d love to hear from you, until then, happy socialising!