Commit 5869d58c9806

Vincent Demeester <vincent@sbr.pm>
2026-10-23 09:59:01
feat(raffi): added browser profile launchers
Provided direct work and personal browser launches while bypassing Firefox's inconsistent legacy profile registry. Signed-off-by: Vincent Demeester <vincent@sbr.pm>
1 parent 2ad8fac
Changed files (3)
dots/config/raffi/scripts/firefox-profile-raffi
@@ -0,0 +1,19 @@
+#!/usr/bin/env bash
+# Launch a selected Firefox profile without relying on the legacy profiles.ini.
+set -euo pipefail
+
+case "${1:-}" in
+  work) profile="$HOME/.mozilla/firefox/default" ;;
+  personal) profile="$HOME/.mozilla/firefox/paT2ehcS.Profile 1" ;;
+  *)
+    echo "usage: $(basename "$0") {work|personal}" >&2
+    exit 2
+    ;;
+esac
+
+if [[ ! -d "$profile" ]]; then
+  echo "Firefox profile does not exist: $profile" >&2
+  exit 1
+fi
+
+exec firefox -no-remote -profile "$profile"
dots/config/raffi/tests/test_firefox_profile_raffi.py
@@ -0,0 +1,46 @@
+"""Tests for the Firefox profile Raffi launcher helper."""
+
+from __future__ import annotations
+
+import os
+import subprocess
+import tempfile
+import unittest
+from pathlib import Path
+
+SCRIPT = Path(__file__).parents[1] / "scripts" / "firefox-profile-raffi"
+
+
+class FirefoxProfileRaffiTests(unittest.TestCase):
+    def test_launches_the_requested_profile_with_an_isolated_instance(self) -> None:
+        with tempfile.TemporaryDirectory() as temporary_directory:
+            temporary_path = Path(temporary_directory)
+            profile = temporary_path / ".mozilla" / "firefox" / "default"
+            profile.mkdir(parents=True)
+            bin_directory = temporary_path / "bin"
+            bin_directory.mkdir()
+            arguments_file = temporary_path / "firefox-arguments"
+            firefox = bin_directory / "firefox"
+            firefox.write_text(
+                f'#!/bin/sh\nprintf "%s\\n" "$@" > "{arguments_file}"\n', encoding="utf-8"
+            )
+            firefox.chmod(0o755)
+
+            subprocess.run(
+                [str(SCRIPT), "work"],
+                check=True,
+                env={
+                    **os.environ,
+                    "HOME": str(temporary_path),
+                    "PATH": f"{bin_directory}:{os.environ['PATH']}",
+                },
+            )
+
+            self.assertEqual(
+                arguments_file.read_text(encoding="utf-8").splitlines(),
+                ["-no-remote", "-profile", str(profile)],
+            )
+
+
+if __name__ == "__main__":
+    unittest.main()
dots/config/raffi/raffi.yaml
@@ -234,6 +234,26 @@ addons:
     icon: wikipedia
 version: 1
 launchers:
+  chrome-work:
+    binary: google-chrome-stable
+    args:
+    - --profile-directory=Default
+    description: Chrome Work
+    icon: google-chrome
+  chrome-personal:
+    binary: google-chrome-stable
+    args:
+    - --profile-directory=Profile 1
+    description: Chrome Personal
+    icon: google-chrome
+  firefox-work:
+    description: Firefox Work
+    icon: firefox
+    script: exec ~/.config/raffi/scripts/firefox-profile-raffi work
+  firefox-personal:
+    description: Firefox Personal
+    icon: firefox
+    script: exec ~/.config/raffi/scripts/firefox-profile-raffi personal
   firefox:
     binary: firefox
     description: Firefox