0018-firefox-is-the-browser-and-themed-to-patina.md (7675B)
1 # 0018. Firefox is the browser, themed to Patina 2 3 Date: 2026-11-27 4 5 ## Status 6 7 Accepted (the user's direction: Firefox as the default browser, with the Patina theming from 8 patina-browser-themes, delivered as an OS update). 9 10 ## Context 11 12 The image had no browser, though Patina already assumes one: its default-apps role is `browser = 13 "firefox"` and Alt+B is `patina-raise firefox`. The image's base `mimeapps.list` gives web links to 14 `org.mozilla.firefox.desktop`, which is the id of Fedora's `firefox` package. 15 16 patina-browser-themes has a Firefox theme, `patina-default.css`, userChrome CSS in the colours of 17 Patina's Default skin. userChrome CSS is read from a profile's `chrome/` folder, and there is no 18 system-wide place for it. 19 20 ## Decision 21 22 - **The image installs `firefox`.** With it the web links, `text/html` and Alt+B already work; nothing 23 else sets the default. 24 - **The theme reaches each profile through a user unit.** `/usr/libexec/patina-firefox-theme` copies 25 the system's copy of the CSS (`/usr/share/patina-os/firefox/`) into every profile in Firefox's 26 `profiles.ini` and imports it at the top of `chrome/userChrome.css`, keeping the user's own rules. 27 `patina-firefox-theme.service` runs it at login (profiles that already exist), and 28 `patina-firefox-theme.path` runs it when Firefox writes `profiles.ini` (its first profile). 29 - **Firefox's defaults are set by its policy file,** `/usr/lib64/firefox/distribution/policies.json`, as 30 defaults a person can change in Settings (`"Status": "default"`): the pref that makes Firefox read 31 userChrome.css; Firefox's own start page (`about:home`) in place of Fedora's, and no Fedora tile pinned on 32 the new-tab page (Fedora's `firefox-redhat-default-prefs.js` sets both); vertical tabs 33 (`sidebar.verticalTabs`); and DuckDuckGo as the default search engine (`SearchEngines.Default`). 34 - **A clean start** (2026-11-28, the state the user had made by hand on a test machine): no default 35 bookmarks (`NoDefaultBookmarks`: Fedora's 67 are not made in a new profile); a new tab page that is the 36 search box and the logo, with no shortcuts, highlights, stories or sponsored tiles (`FirefoxHome`); and 37 a toolbar without the VPN button and the account button, as a default toolbar layout 38 (`browser.uiCustomization.state`, the layout the user ended on, with `ipprotection-button` already in 39 its "seen" list so Firefox does not add it back). 40 - **"Use Linux system theme" is off by default** (`browser.theme.native-theme`, the pref behind that checkbox 41 under Add-ons, Themes, Default; found by opening the page in a fresh profile and reading the checkbox: 42 on with the pref true, off with it false). Firefox then draws its own colours instead of taking them from 43 GTK. Its Light, Dark or Device choice is left on Device, so it still follows the desktop's light or 44 dark setting; only where the colours come from changes. 45 - **Nothing here takes a choice away from the person, and an update never changes one.** Checked in 46 Firefox's own policy source, then by running it: 47 - the `Preferences` and `FirefoxHome` policies set defaults, which a user's own value sits on top of; 48 - `SearchEngines.Default` runs once per change of its value (`runOncePerModification`), so a search 49 engine chosen later survives restarts and updates (changing that value in this file would apply 50 it once more, so it is left alone); 51 - `NoDefaultBookmarks` is only about a new profile's first start; 52 - **`DisableFirefoxAccounts` is not used:** it locks `identity.fxaccounts.enabled` off, so Sync could never 53 be turned on, and it did not hide the toolbar button anyway; 54 - the default toolbar layout loses to the person's own: with the account button put back by the user and 55 Firefox restarted, it stayed. 56 - The CSS is a copy of patina-browser-themes' file at the commit named in its header; that 57 repository is the source. 58 59 - **The window's corners are set to Patina's 15 px in GTK too.** Firefox draws the frame of its window 60 (the outline and the transparent corners) from GTK3's own theme, whose corners are 8 px. The theme's 61 CSS rounds the page at 15 px, so the outline ran inside the page's corners and showed as a dark wedge 62 at each one (seen on a real machine). `patina-firefox-theme` therefore keeps a marked block in 63 `~/.config/gtk-3.0/gtk.css` that sets the window decoration to 15 px, for windows that are not 64 maximized, fullscreen or tiled. A file containing `/* patina: do not manage */` is left alone. 65 Compared on the machine with a throwaway Firefox profile: without the block the wedge shows; with 66 it the outline follows the page's corner. 67 68 - **A new profile starts with the new tab widgets off, as the user's own values.** Clocks, timer, lists, 69 weather and the widgets master switch cannot be a default: Firefox works out their defaults itself, after 70 the policy engine and the default-pref files have run (the market gate in the new tab code), and the value 71 it computes wins. Tried and failed: the `Preferences` policy, `FirefoxHome.Widgets`, a default-pref file in 72 Firefox's folder (which does load), and the market-gate pref. The only other way is to lock them, which takes 73 the choice away. So `patina-firefox-theme`, at login, **when there is no Firefox profile at all**, makes the 74 profile before Firefox's first start, with those prefs in its `prefs.js`, mapped to this install in 75 `installs.ini` (the key, `11457493C5A56847`, is a hash of `/usr/lib64/firefox`; Firefox writes it itself; 76 without it Firefox ignored the profile and made another). It is the state a person who switches the widgets 77 off in Customize ends up in. From then on the values are theirs: the script does nothing when a profile 78 exists, so no login or update changes it. Tried: the first start adopts the profile (the only one on disk), 79 and a pref the user changes stays changed after a clean restart. A first start is also themed, since the 80 theme goes into the profile before Firefox runs. Tested in `linux/tests/patina-firefox-theme.sh`. 81 A machine that already has a profile (one that was set up by hand, or an older install) is not seeded. 82 83 ## Tried and rejected 84 85 - **A system-wide GTK CSS file** (`/etc/xdg/gtk-3.0/gtk.css`, through `XDG_CONFIG_DIRS`): GTK3 did not 86 read it; the wedge stayed. GTK3 reads `gtk.css` only from the user's own config folder, hence the 87 per-user block above. 88 89 - **Firefox's profile-defaults folder** (`browser/defaults/profile` and `defaults/profile`, which Firefox 90 documents as a template for new profiles): Firefox 161 did not copy either into the profile it makes 91 on a first start, with or without a `user.js` in them. 92 - **AutoConfig** would write the files from Firefox's own start-up, but it is a script run inside 93 every Firefox start, and more to break with each release. 94 95 - **A default-prefs file did not work** for the start page: a file in `browser/defaults/preferences` 96 (`zz-patina.js`) turned vertical tabs on but Fedora's own file in the same folder kept its homepage and 97 pinned tile. The policy's `Preferences` are applied after the pref files, and did override them. 98 Measured by starting Firefox with Marionette and reading the prefs: homepage, pinned tile and vertical 99 tabs as above. 100 101 ## Gaps 102 103 104 - **It matches Patina's Default skin, not the desktop's default.** The theme's colours are egui's 105 stock greys; the desktop's default skin is Everforest Dark (patina-desktop's ADR-0100). Next to the 106 desktop, Firefox is a shade off. An Everforest variant is a change in patina-browser-themes. 107 - Firefox reads userChrome.css at start-up, so the first start of a new profile is unthemed and the 108 second is themed.