Skip to main content

How to separate work/personal life on Firefox

·3 mins

Two Firefox

I’m an avid Firefox user, both at work and in my personal life. As such I have some conflincting settings and addons. For example, I use the Lastpass addon in both contexts but since I use different accounts, I needed a way to get them to cohabitate. To cope with that, Firefox comes with profiles.

Firefox profiles? #

Firefox comes with profiles, you can use them to isolate a set of settings/addons/plugins/bookmarks/…

You can have different profiles but you must set one as default. This default profile will be the one used when you start Firefox without setting a profile.

To open firefox with a different profile:

firefox -p ProfileName

This will start a new firefox instance with its own history/set of addons/settings etc.

Create a Desktop Entry for this new profile #

We will need to create a new desktop entry. What I did is copying the one from Firefox and changing it to match my needs. You can find that file in /usr/share/applications/firefox.desktop.

We have different options that we will tweak there: Name, Generic Name and Exec.

  • Name: This is the name of the application, change it to something different, I use “Firefox Personal”.
  • Generic Name: Generic Name for the application, in our case it’s a Web Browser.
  • Icon: We will want a different icon to differentiate our two instances, firefox-nightly is a good fit if you aren’t using it already.
  • StartupWMClass: An identifier that Gnome will use to track the application. It will also make sure that an instance of our new Firefox profile will share the same group as our work Firefox.
  • Exec: Command to execute to start the application, by default this is firefox %u but we will need to add some options:
    • --class "Firefox Personal": this is the WMClass we talked about earlier, our Desktop Environment will use it to group windows together
    • -p Personal: the firefox profile to start this instance
    • -no-remote: we don’t want our two firefox instances to mix up, this will prevent external commands to run against this instance. It will also tell firefox to create a new instance

In the end, your ~/.local/share/applications/firefox_perso.desktop should look like this:

[Desktop Entry]
Name=Firefox Personal
GenericName=Firefox Personal
Exec=firefox --class "Firefox Personal" -p Personal -no-remote %u
Terminal=false
X-MultipleArgs=false
Type=Application
Icon=firefox-nightly
Categories=GNOME;GTK;Network;WebBrowser;
MimeType=text/html;text/xml;application/xhtml+xml;application/xml;application/rss+xml;application/rdf+xml;image/gif;image/jpeg;image/png;x-scheme-handler/http;x-scheme-handler/https;x-scheme-handler/ftp;x-scheme-handler/chrome;video/webm;application/x-xpinstall;
StartupNotify=true
Actions=new-personal-window;new-personal-private-window;
StartupWMClass=Firefox Personal

[Desktop Action new-personal-window]
Name=Open a New Window
Name[ar]=ﺎﻔﺘﺣ ﻥﺎﻓﺫﺓ ﺝﺪﻳﺩﺓ
Name[ast]=Abrir una ventana nueva
Name[bn]=Abrir una ventana nueva
Name[ca]=Obre una finestra nova
Name[cs]=Otevřít nové okno
Name[da]=Åbn et nyt vindue
Name[de]=Ein neues Fenster öffnen
Name[el]=Νέο παράθυρο
Name[es]=Abrir una ventana nueva
Name[fi]=Avaa uusi ikkuna
Name[fr]=Ouvrir une nouvelle fenêtre
Name[gl]=Abrir unha nova xanela
Name[he]=פתיחת חלון חדש
Name[hr]=Otvori novi prozor
Name[hu]=Új ablak nyitása
Name[it]=Apri una nuova finestra
Name[ja]=新しいウィンドウを開く
Name[ko]=새 창 열기
Name[ku]=Paceyeke nû veke
Name[lt]=Atverti naują langą
Name[nb]=Åpne et nytt vindu
Name[nl]=Nieuw venster openen
Name[pt]=Abrir nova janela
Name[pt_BR]=Abrir nova janela
Name[ro]=Deschide o fereastră nouă
Name[ru]=Новое окно
Name[sk]=Otvoriť nové okno
Name[sl]=Odpri novo okno
Name[sv]=Öppna ett nytt fönster
Name[tr]=Yeni pencere aç
Name[ug]=ﻱېڭﻯ ﻙۆﺰﻧەﻙ ﺉېچﻰﺷ
Name[uk]=Відкрити нове вікно
Name[vi]=Mở cửa sổ mới
Name[zh_CN]=新建窗口
Name[zh_TW]=開啟新視窗
Exec=firefox --class "Firefox Personal" -p Personal -new-window

That’s it! #

Enjoy your separate Firefox instance. A tip: change your personal Firefox theme so to differentiate the two, I personnaly use Arc Dark Theme.