Package: dotbot-firefox
Configure your Firefox profile(s) usingdotbot.Table of contentsWhat you can do with itInstallationConfigurationFirefox profile locationsDevelopmentWhat you can do with itWhen Firefox starts, it will look for auser.jsfile in your profile directory.
If found, theuser.jssettings will be copied toprefs.jsand used.You can enforce a consistent Firefox configuration across all your profiles
by using dotbot-firefox to create symlinks to a customuser.js.
The plugin will find Firefox profile directories that contain aprefs.jsfile
and will use dotbot’s builtin Link plugin to create the symlinks.InstallationThere are two ways to install and use the plugin:Install it as a Python package.Add it as a git submodule in your dotfiles repository.Copydotbot_firefox.pyinto your dotfiles directory.Python packageIf you want to install dotbot-firefox as a Python package
(for example, if you’re using a virtual environment),
then you can install the plugin usingpip:pip install dotbot-firefoxThen, when running dotbot, use the-por--pluginoption
to tell dotbot to load the plugin:dotbot [...] --plugin dotbot_firefox [...]If you’re using one of dotbot’sinstallscripts,
you’ll need to edit that file to add the--pluginoption.Git submoduleIf you want to track dotbot-firefox as a git submodule
(for example, if you manage your dotfiles using git)
then you can add the plugin repository as a submodule usinggit:git submodule add https://github.com/kurtmckee/dotbot-firefox.gitThis will clone the repository to a directory nameddotbot-firefox.
Then, when running dotbot, use the-por--pluginoption
to tell dotbot to load the plugin:dotbot [...] --plugin dotbot-firefox/dotbot_firefox.py [...]Note that you may need to initialize the plugin’s git submodule
when you clone your dotfiles repository or pull new changes
to another computer.
The command for this will look something like:git submodule update --init dotbot-firefoxCopydotbot_firefox.pyIf desired, you can copydotbot_firefox.pyto your dotfiles directory.
You might choose to do this if you already use other plugins
and have configured dotbot to load all plugins from a plugin directory.If you copydotbot_firefox.pyto the root of your dotfiles directory
then, when running dotbot, use the-por--pluginoption
to tell dotbot to load the plugin:dotbot [...] --plugin dotbot_firefox.py [...]If you copydotbot_firefox.pyto a directory containing other plugins,
you can use dotbot’s--plugin-diroption to load all plugins in the directory.
In the example below, the plugin directory is nameddotbot-plugins:dotbot [...] --plugin-dir dotbot-plugins [...]ConfigurationFirst, create auser.jsfile in the dotfiles directory that dotbot manages.
For example, it could contain this configuration to set your homepage:user_pref("browser.startup.homepage","https://dashboard.example");(MozillaZine maintains an extensive list ofFirefox configuration settings.)Then, add afirefoxdirective to your dotbot config with auser.jskey.
The value of the key follows the syntax of thedotbot Link plugin.# Example 1:# "user.js" can be specified as a string.firefox:user.js:firefox/user.js# Example 2:# "user.js" can have no value, and will be found# in the same directory as your dotbot config file.firefox:user.js:# Example 3:# The extended Link plugin syntax is supported.firefox:user.js:path:firefox/user.jsforce:trueFirefox profile locationsThe dotbot-firefox plugin is aware of the following default directories:%APPDATA%\Mozilla\Firefox\Profiles(Windows)~/Library/Application Support/Firefox/Profiles(Mac OS)~/.mozilla/firefox(Linux)~/snap/firefox/common/.mozilla/firefox(Firefox Snap for Linux)~/.var/app/org.mozilla.firefox/.mozilla/firefox(Firefox Flatpak for Linux)Only profile subdirectories that contain aprefs.jsfile
will be considered valid by the plugin.DevelopmentTo set up a development environment, clone the dotbot-firefox plugin’s git repository.
Then, follow these steps to create a virtual environment and run the unit tests locally:# Create the virtual environment$python-mvenv.venv# Activate the virtual environment (Linux)$..venv/bin/activate# Activate the virtual environment (Windows)$&.venv/Scripts/Activate.ps1# Update pip and setuptools, and install wheel(.venv)$pipinstall-Upipsetuptoolswheel# Install poetry and tox(.venv)$pipinstallpoetrytox# Install all dependencies(.venv)$poetryinstall# Run the unit tests locally(.venv)$tox