sector-f-linux

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

commit 87a5c9d13851a9a2874c6078c4757e2c5ece7b50
parent 1e4c585f555fc838be18eb5a67fccce54ddfdebe
Author: Divan Visagie <me@divanv.com>
Date:   Sat, 28 Nov 2026 00:27:56 +0100

firefox: round the window's frame to 15 px in GTK too, so the Patina theme has no dark corners

What the user saw: on the real machine the Firefox window had a thin black outline at each corner
that did not follow the page's rounded corner, "like a wire sticking out of it".

Why: Firefox draws the frame of its window (the outline and the transparent corners) from GTK3's
own theme, and GTK3's Adwaita has an 8 px corner. patina-browser-themes' CSS rounds the page at
Patina's 15 px. The outline's tighter corner therefore runs inside the page's larger one, leaving a
dark wedge between them. Measured, not guessed: I started a throwaway Firefox profile on that
machine (nothing of the user's touched), captured its screen with grim, and compared one corner
enlarged. Without a change the wedge is there; with `decoration { border-radius: 15px }` in the
user's gtk-3.0/gtk.css the outline hugs the page.

How: patina-firefox-theme (which already themes the profiles, at login) also keeps a marked block in
~/.config/gtk-3.0/gtk.css that sets the window decoration to 15 px. GTK ranks a user stylesheet
above the theme's own rules, so a bare rule would round a maximized window too; the selector leaves
out maximized, fullscreen and tiled windows. The block is replaced in place on each run, anything
else in the file is kept, and a file with `/* patina: do not manage */` is left alone. Tested on
fake homes (no file, an existing file with the user's own rules, a repeat run, the opt-out line) and
on the real machine with the exact block the script writes.

Why not a system-wide file: tried /etc/xdg through XDG_CONFIG_DIRS, which GTK3 does not read for
CSS (the wedge stayed), so it has to be per user. Recorded in ADR-0018.

Diffstat:
Mdocs/adr/0018-firefox-is-the-browser-and-themed-to-patina.md | 13+++++++++++++
Mlinux/system/usr/libexec/patina-firefox-theme | 27+++++++++++++++++++++++++++
2 files changed, 40 insertions(+), 0 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 @@ -34,8 +34,21 @@ system-wide place for it. - The CSS is a copy of patina-browser-themes' file at the commit named in its header; that repository is the source. +- **The window's corners are set to Patina's 15 px in GTK too.** Firefox draws the frame of its window + (the outline and the transparent corners) from GTK3's own theme, whose corners are 8 px. The theme's + CSS rounds the page at 15 px, so the outline ran inside the page's corners and showed as a dark wedge + at each one (seen on a real machine). `patina-firefox-theme` therefore keeps a marked block in + `~/.config/gtk-3.0/gtk.css` that sets the window decoration to 15 px, for windows that are not + maximized, fullscreen or tiled. A file containing `/* patina: do not manage */` is left alone. + Compared on the machine with a throwaway Firefox profile: without the block the wedge shows; with + it the outline follows the page's corner. + ## Tried and rejected +- **A system-wide GTK CSS file** (`/etc/xdg/gtk-3.0/gtk.css`, through `XDG_CONFIG_DIRS`): GTK3 did not + read it; the wedge stayed. GTK3 reads `gtk.css` only from the user's own config folder, hence the + per-user block above. + - **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. diff --git a/linux/system/usr/libexec/patina-firefox-theme b/linux/system/usr/libexec/patina-firefox-theme @@ -12,6 +12,33 @@ # /usr/lib64/firefox/distribution/policies.json.) set -eu +# GTK draws the frame of Firefox's window (its outline and the transparent corners) from its own +# theme, whose corners are 8 px; the theme's CSS rounds the page at Patina's 15 px, so the outline +# runs inside the page's corners and shows as a dark wedge. GTK3 reads a CSS file only from the +# user's own config folder, so a block in ~/.config/gtk-3.0/gtk.css sets the frame to 15 px too. +# Not for a window that is maximized, fullscreen or tiled (those are square). A file that has the +# line /* patina: do not manage */ is left alone. +gtk=${XDG_CONFIG_HOME:-$HOME/.config}/gtk-3.0/gtk.css +begin='/* >>> patina: window corners (managed by patina-firefox-theme) */' +end='/* <<< patina */' +if ! grep -qF '/* patina: do not manage */' "$gtk" 2>/dev/null; then + block=$(cat <<EOF +$begin +window.csd:not(.maximized):not(.fullscreen):not(.tiled):not(.tiled-top):not(.tiled-bottom):not(.tiled-left):not(.tiled-right) decoration { + border-radius: 15px; +} +$end +EOF +) + mkdir -p "$(dirname "$gtk")" + touch "$gtk" + # The rest of the file, without an earlier copy of the block. + rest=$(awk -v b="$begin" -v e="$end" '$0 == b { skip = 1; next } $0 == e { skip = 0; next } !skip' "$gtk") + new=$block + [ -z "$rest" ] || new=$block$(printf '\n\n%s' "$rest") + [ "$(cat "$gtk")" = "$new" ] || printf '%s\n' "$new" > "$gtk" +fi + theme=patina-default src=/usr/share/patina-os/firefox/$theme.css [ -f "$src" ] || exit 0