sector-f-linux

Sector F Linux
git clone https://git.sectorflabs.com/sector-f-linux.git
Log | Files | Refs | README | LICENSE

commit 1e4c585f555fc838be18eb5a67fccce54ddfdebe
parent 243114f554e32ecb21bf48da072bde6dd1bb4f83
Author: Divan Visagie <me@divanv.com>
Date:   Sat, 28 Nov 2026 00:14:04 +0100

image: Firefox as the browser, themed to Patina, with Patina's defaults; a shadow for the updater (ADR-0018)

- Installs Firefox. Fedora's desktop file, org.mozilla.firefox.desktop, is what the image's
  mimeapps.list already gives web links to, so it is the default browser.
- Theme: patina-browser-themes' Firefox theme (userChrome CSS). Firefox 161 does not copy a
  profile-defaults template into the profile it makes, so patina-firefox-theme (a script) puts the
  CSS into each profile and imports it first in userChrome.css, keeping the user's rules; a user unit
  runs it at login and a path unit runs it when Firefox writes profiles.ini. Tried in the VM: a real
  first Firefox start made its profile and the theme appeared in it.
- Defaults, in Firefox's policy file (a prefs file lost to Fedora's own for the start page): Firefox's
  own start page and no Fedora tile on the new-tab page, vertical tabs, DuckDuckGo as the default
  search engine, and the pref that makes Firefox read userChrome.css. Read back from a running
  Firefox through Marionette, and seen on the VM's desktop (DuckDuckGo in the address bar, the tabs
  down the side).
- patina-updater asks the compositor for its window shadow, as Patina's other apps do. On the VM's
  desktop the brightness falls from the wallpaper's 51.7 to 39 at the window's edge on three sides.

The theme matches Patina's Default skin; the desktop's default is Everforest Dark (ADR-0018, Gaps).

Diffstat:
Adocs/adr/0018-firefox-is-the-browser-and-themed-to-patina.md | 58++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mlinux/Containerfile | 7++++++-
Alinux/system/usr/lib/systemd/user/default.target.wants/patina-firefox-theme.path | 2++
Alinux/system/usr/lib/systemd/user/default.target.wants/patina-firefox-theme.service | 2++
Alinux/system/usr/lib/systemd/user/patina-firefox-theme.path | 11+++++++++++
Alinux/system/usr/lib/systemd/user/patina-firefox-theme.service | 10++++++++++
Alinux/system/usr/lib64/firefox/distribution/policies.json | 14++++++++++++++
Alinux/system/usr/libexec/patina-firefox-theme | 41+++++++++++++++++++++++++++++++++++++++++
Alinux/system/usr/share/patina-os/firefox/patina-default.css | 48++++++++++++++++++++++++++++++++++++++++++++++++
Mupdater/docs/screenshot-available.png | 0
Mupdater/src/app.rs | 7++++++-
Mupdater/src/system.rs | 6+++++-
12 files changed, 203 insertions(+), 3 deletions(-)

diff --git a/docs/adr/0018-firefox-is-the-browser-and-themed-to-patina.md b/docs/adr/0018-firefox-is-the-browser-and-themed-to-patina.md @@ -0,0 +1,58 @@ +# 0018. Firefox is the browser, themed to Patina + +Date: 2026-11-27 + +## Status + +Accepted (the user's direction: Firefox as the default browser, with the Patina theming from +patina-browser-themes, delivered as an OS update). + +## Context + +The image had no browser, though Patina already assumes one: its default-apps role is `browser = +"firefox"` and Alt+B is `patina-raise firefox`. The image's base `mimeapps.list` gives web links to +`org.mozilla.firefox.desktop`, which is the id of Fedora's `firefox` package. + +patina-browser-themes has a Firefox theme, `patina-default.css`, userChrome CSS in the colours of +Patina's Default skin. userChrome CSS is read from a profile's `chrome/` folder, and there is no +system-wide place for it. + +## Decision + +- **The image installs `firefox`.** With it the web links, `text/html` and Alt+B already work; nothing + else sets the default. +- **The theme reaches each profile through a user unit.** `/usr/libexec/patina-firefox-theme` copies + the system's copy of the CSS (`/usr/share/patina-os/firefox/`) into every profile in Firefox's + `profiles.ini` and imports it at the top of `chrome/userChrome.css`, keeping the user's own rules. + `patina-firefox-theme.service` runs it at login (profiles that already exist), and + `patina-firefox-theme.path` runs it when Firefox writes `profiles.ini` (its first profile). +- **Firefox's defaults are set by its policy file,** `/usr/lib64/firefox/distribution/policies.json`, as + defaults a person can change in Settings (`"Status": "default"`): the pref that makes Firefox read + userChrome.css; Firefox's own start page (`about:home`) in place of Fedora's, and no Fedora tile pinned on + the new-tab page (Fedora's `firefox-redhat-default-prefs.js` sets both); vertical tabs + (`sidebar.verticalTabs`); and DuckDuckGo as the default search engine (`SearchEngines.Default`). +- The CSS is a copy of patina-browser-themes' file at the commit named in its header; that + repository is the source. + +## Tried and rejected + +- **Firefox's profile-defaults folder** (`browser/defaults/profile` and `defaults/profile`, which Firefox + documents as a template for new profiles): Firefox 161 did not copy either into the profile it makes + on a first start, with or without a `user.js` in them. +- **AutoConfig** would write the files from Firefox's own start-up, but it is a script run inside + every Firefox start, and more to break with each release. + +- **A default-prefs file did not work** for the start page: a file in `browser/defaults/preferences` + (`zz-patina.js`) turned vertical tabs on but Fedora's own file in the same folder kept its homepage and + pinned tile. The policy's `Preferences` are applied after the pref files, and did override them. + Measured by starting Firefox with Marionette and reading the prefs: homepage, pinned tile and vertical + tabs as above. + +## Gaps + + +- **It matches Patina's Default skin, not the desktop's default.** The theme's colours are egui's + stock greys; the desktop's default skin is Everforest Dark (patina-desktop's ADR-0100). Next to the + desktop, Firefox is a shade off. An Everforest variant is a change in patina-browser-themes. +- Firefox reads userChrome.css at start-up, so the first start of a new profile is unthemed and the + second is themed. diff --git a/linux/Containerfile b/linux/Containerfile @@ -52,6 +52,10 @@ FROM base AS system # smb://, and the FUSE bridge in /run/user/<uid>/gvfs), so gvfs, its Samba backend and its FUSE # bridge; samba-client and cifs-utils are the command-line side (smbclient, mount.cifs). # +# The web browser: Firefox, which Patina's defaults and Alt+B already name. Its desktop file, +# org.mozilla.firefox.desktop, is what the base mimeapps.list gives web links to. Themed to Patina +# by files under system/usr/lib64/firefox (ADR-0018). +# # Not here yet: the NVIDIA driver, which comes from RPM Fusion or NVIDIA's own # repository and is built against the image's kernel at build time. RUN dnf -y --setopt=install_weak_deps=False install \ @@ -74,7 +78,8 @@ RUN dnf -y --setopt=install_weak_deps=False install \ NetworkManager-wifi wpa_supplicant \ iwlwifi-dvm-firmware iwlwifi-mvm-firmware iwlwifi-mld-firmware iwlegacy-firmware \ iwlbluetooth-firmware libertas-firmware \ - samba-client cifs-utils gvfs gvfs-smb gvfs-fuse && \ + samba-client cifs-utils gvfs gvfs-smb gvfs-fuse \ + firefox && \ dnf clean all # The Patina desktop and Files, and its session: laid out under / by desktop/build.sh. And the diff --git a/linux/system/usr/lib/systemd/user/default.target.wants/patina-firefox-theme.path b/linux/system/usr/lib/systemd/user/default.target.wants/patina-firefox-theme.path @@ -0,0 +1 @@ +../patina-firefox-theme.path +\ No newline at end of file diff --git a/linux/system/usr/lib/systemd/user/default.target.wants/patina-firefox-theme.service b/linux/system/usr/lib/systemd/user/default.target.wants/patina-firefox-theme.service @@ -0,0 +1 @@ +../patina-firefox-theme.service +\ No newline at end of file diff --git a/linux/system/usr/lib/systemd/user/patina-firefox-theme.path b/linux/system/usr/lib/systemd/user/patina-firefox-theme.path @@ -0,0 +1,11 @@ +[Unit] +Description=Theme Firefox's profile when Firefox makes or changes it + +[Path] +# Firefox writes profiles.ini when it creates its first profile. +PathChanged=%h/.config/mozilla/firefox/profiles.ini +PathChanged=%h/.mozilla/firefox/profiles.ini +Unit=patina-firefox-theme.service + +[Install] +WantedBy=default.target diff --git a/linux/system/usr/lib/systemd/user/patina-firefox-theme.service b/linux/system/usr/lib/systemd/user/patina-firefox-theme.service @@ -0,0 +1,10 @@ +[Unit] +Description=Patina's theme for Firefox +Documentation=file:///usr/libexec/patina-firefox-theme + +[Service] +Type=oneshot +ExecStart=/usr/libexec/patina-firefox-theme + +[Install] +WantedBy=default.target diff --git a/linux/system/usr/lib64/firefox/distribution/policies.json b/linux/system/usr/lib64/firefox/distribution/policies.json @@ -0,0 +1,14 @@ +{ + "policies": { + "Preferences": { + "toolkit.legacyUserProfileCustomizations.stylesheets": { "Value": true, "Status": "default" }, + "browser.startup.homepage": { "Value": "about:home", "Status": "default" }, + "browser.newtabpage.pinned": { "Value": "", "Status": "default" }, + "sidebar.revamp": { "Value": true, "Status": "default" }, + "sidebar.verticalTabs": { "Value": true, "Status": "default" } + }, + "SearchEngines": { + "Default": "DuckDuckGo" + } + } +} diff --git a/linux/system/usr/libexec/patina-firefox-theme b/linux/system/usr/libexec/patina-firefox-theme @@ -0,0 +1,41 @@ +#!/bin/sh +# Puts Patina's Firefox theme into the user's Firefox profiles (ADR-0018): +# +# patina-firefox-theme +# +# The theme is userChrome CSS, which Firefox reads from a profile's chrome/ folder: the system's +# copy, /usr/share/patina-os/firefox/patina-default.css (from patina-browser-themes), is copied there +# and imported at the top of chrome/userChrome.css, where anything of the user's stays. Every profile +# in Firefox's profiles.ini gets it. Safe to run again, and a no-op without a profile. Run as the +# user, by systemd: at login, and when Firefox first writes its profiles.ini. +# (The pref that has Firefox read userChrome.css is set for every profile by the policy in +# /usr/lib64/firefox/distribution/policies.json.) +set -eu + +theme=patina-default +src=/usr/share/patina-os/firefox/$theme.css +[ -f "$src" ] || exit 0 +import="@import url(\"$theme.css\");" + +for root in "${XDG_CONFIG_HOME:-$HOME/.config}/mozilla/firefox" "$HOME/.mozilla/firefox"; do + ini=$root/profiles.ini + [ -f "$ini" ] || continue + # Each profile's Path, and whether it is relative to the folder profiles.ini is in. + awk -F= ' + /^\[/ { if (path != "") print rel "\t" path; path = ""; rel = 1; next } + $1 == "Path" { path = $2 } + $1 == "IsRelative" { rel = $2 } + END { if (path != "") print rel "\t" path }' "$ini" | + while IFS=" " read -r rel path; do + if [ "$rel" = 1 ]; then dir=$root/$path; else dir=$path; fi + [ -d "$dir" ] || continue + mkdir -p "$dir/chrome" + cp -f "$src" "$dir/chrome/$theme.css" + css=$dir/chrome/userChrome.css + touch "$css" + # Already first? Then nothing more to do (and nothing rewritten). + [ "$(head -n 1 "$css")" = "$import" ] && continue + { echo "$import"; grep -vxF "$import" "$css" || true; } > "$css.new" + mv "$css.new" "$css" + done +done diff --git a/linux/system/usr/share/patina-os/firefox/patina-default.css b/linux/system/usr/share/patina-os/firefox/patina-default.css @@ -0,0 +1,48 @@ +/* Copied from patina-browser-themes/firefox/patina-default.css (commit 10de23c); that repository is the + source, so change it there and copy it here. See docs/adr/0018. */ + +/* Patina Default for Firefox: the colours of Patina's Default skin, egui's + * stock look following the desktop's light or dark setting, as the Zen mod + * has them: the panel colour for the chrome, the shown tab in the surface + * colour as Patina's tabs are, and the thin, lighter border round the window + * and between the toolbars and the page (`panel_fill`, `extreme_bg_color` + * and `window_stroke` in egui 0.35's `Visuals::light()` and `dark()`). */ + +:root { + --patina-background: light-dark(#f8f8f8, #1b1b1b); + --patina-surface: light-dark(#ffffff, #0a0a0a); + --patina-border: light-dark(#bebebe, #3c3c3c); + + --toolbox-background-color: var(--patina-background) !important; + --toolbox-background-color-inactive: var(--patina-background) !important; + --toolbar-background-color: var(--patina-background) !important; + --tab-background-color-selected: var(--patina-surface) !important; + --chrome-content-separator-color: var(--patina-border) !important; + --tabs-navbar-separator-color: var(--patina-border) !important; +} + +/* The window's edge, over everything and not in the pointer's way; none + * when it fills the screen. */ +:root:not([sizemode="maximized"], [sizemode="fullscreen"]) body::after { + content: ""; + position: fixed; + inset: 0; + border: 1px solid var(--patina-border); + border-radius: var(--patina-window-radius, 0); + pointer-events: none; + z-index: 2147483647; +} + +/* Corners rounded like a Patina window's (frame.rs' WINDOW_RADIUS), where + * Firefox rounds them by the GTK theme's: a floating window, on a desktop + * that composites (browser.css's titlebar rules). */ +@media (-moz-gtk-csd-transparency-available) { + :root[customtitlebar][sizemode="normal"]:not([tiled]) { + --patina-window-radius: 15px; + + & body, + & dialog::backdrop { + border-radius: var(--patina-window-radius) !important; + } + } +} diff --git a/updater/docs/screenshot-available.png b/updater/docs/screenshot-available.png Binary files differ. diff --git a/updater/src/app.rs b/updater/src/app.rs @@ -570,7 +570,12 @@ impl App { } impl eframe::App for App { - fn ui(&mut self, ui: &mut egui::Ui, _frame: &mut eframe::Frame) { + fn ui(&mut self, ui: &mut egui::Ui, frame: &mut eframe::Frame) { + // The window draws its own frame, so nothing gives it a shadow: ask the compositor to + // (Patina's ADR-0030). It does nothing off Wayland, or once it has been asked. + if self.custom_frame { + patina::frame::shadow::request(frame); + } let ctx = ui.ctx().clone(); self.poll(); let events = ui.input(|i| i.events.clone()); diff --git a/updater/src/system.rs b/updater/src/system.rs @@ -185,7 +185,11 @@ mod tests { #[test] fn what_rpm_ostree_really_prints() { let s = parse_status(include_str!("../tests/rpm-ostree-status.json")).unwrap(); - assert!(s.image.contains('/') && !s.image.contains("ostree-"), "{}", s.image); + assert!( + s.image.contains('/') && !s.image.contains("ostree-"), + "{}", + s.image + ); assert!(s.digest.starts_with("sha256:"), "{}", s.digest); assert!(!s.version.is_empty()); assert!(!s.staged && !s.can_roll_back);