Best viewed on a real computer!

← Back

Backing up your Firefox Config in a .dotfiles repo

Tags: tutorial tech

DISCLAIMER: Spare yourself from my suffering and don't actually follow this guide. It is incredibly autistic; setting this up is needlessly difficult.

Ever since I started using Linux and dived into using tilling window managers, I have learned how to backup every single configuration file that I have ever modified or written into a ~/.dotfiles repo. The tilling window manager part really helped me to make a repo, but it wasn’t something necessary because I am using KDE Plasma now and I still manage my config files in a git repository. What I love about this is that, not only can I save all of my work and switch computers having my configs like it was in seconds, but it a also gives me complete sovereignty, I do not need to rely on anyone to backup my config files for me, like a Firefox account or something.

Well, almost every single config file apart from browser, profiles/config. For some reason, arguably one of the most important pieces of software one has on his computer’s config files are a complete utter mess to backup. In my case, I’ve been using Firefox/Firefox forks for a very long time, before even considering using Linux on my main desktop computer.

I really don’t understand why does Firefox profiles are the way they are, taking the example of LibreWolf (it stores the config at ~/.librewolf whereas the default Firefox is ~/.mozilla/firefox I think but I’m not sure): by default, when you first open the browser after installing it, or if you delete ~/.librewolf, it creates a folder name (random).default and (random).default-default inside it, where .default-default is the folder where your default profile is stored, and .default that does apparently nothing for some reason. It is really weird, the randomness part was the thing that kept me from making a git repository simply because, well how would I do it if it is random? It would just not work at all.

Well turns out there is a way to change that, making it possible to add your Firefox config into your dotfiles repository! For that I would recommend installing a fork of Firefox like Mercury or LibreWolf because you will need to delete your profiles to actually migrate/save your config in a dotfiles repo, well technically you don’t specifically need to delete but I kept deleting and relaunching my browser and asking ChatGPT which files I should save, but I still recommend doing this on a clean install of Firefox because it is easier to navigate I guess.

To change the way that profiles are generated and used there are two .ini files that you will have to change inside the Firefox profiles folder: profiles.ini and installs.ini. Here are mine:





What does *6DB62B9939B8ED51 do? I don’t know, I’m assuming that yours is different, so just modify this to look +- like mine. When modifying, close the browser and then delete everything inside the profiles (rm -rf ~/.librewolf/ or your browser’s config folder) folder keeping only the .ini files.

image 20231021_155317.png

Now, when you open your browser, a folder with the name you chose should appear. This makes it soo much easier to back up in a .dotfiles repo… I personally would like to store: my preferences in about:config, bookmarks and favicons, extensions, userChrome.css and search engine preferences, I wouldn’t like to store any cookies for obvious reasons or anything else really, this way I can sort of sync my Firefox config across my devices, maybe, although less seamlessly than with a Firefox account but moving away from it is what I want most.

Now the actual configuration. Firefox and I’m also assuming Chromium profiles folders (the actual profile now like profile.diowo I just showed) stores configs in the most autistic way possible:

image 20231021_160328.png

You will now have to copy these files I just mentioned to your dotfiles repo relative to your new, (clean: preferably fork) of Firefox’s folder profile location. It is weird to explain but if you’re used to dealing with dotfiles you probably understood what I meant. I personally like to use GNU Stow to manage my dotfiles and you can find a good video about here. I put all of my dotfiles in a git repository inside the folder src/, It looks like this:

image 20231021_170903.png

Now, you will also need to add some things to your .gitignore file to ignore everything that is not what I specifically mentioned above:


Now in my case I would just cd in my git repo and issue some commands:

1rm -rf ~/.librewolf # (or your fork's folder)
2git add .
3git commit -m "add firefox config"
4git push
5stow --adopt -t ~ src/
6git restore .

As you probably saw before I also like to add the folder native-messaging-hosts to my dotfiles repo, well I only use this for the integration with KeePassXC, inside this folder is a config file named org.keepassxc.keepassxc_browser.json:

2    "allowed_extensions": [
3        "keepassxc-browser@keepassxc.org"
4    ],
5    "description": "KeePassXC integration with native messaging support",
6    "name": "org.keepassxc.keepassxc_browser",
7    "path": "/usr/bin/keepassxc-proxy",
8    "type": "stdio"

I think that’s enough for you to make your own dotfiles with Firefox. I would show my dotfiles repository but I have set it to private because I am not sure how much private information is there, I assume it’s fine but I don’t want to take the risk.

Saturday, October 21, 2023

Cool Hyperlink Dump
Integrating emailwiz and Caddy V2 (on Debian 12)