Skip to content

LordOS — a free, fast and secure GNU/Linux distribution based on Debian, with its own desktop environment: display server and Wayland compositor in C, a React UI engine on QuickJS, and private native apps.

Docs: the browsers' title bar switch (WAYLAND, SETTINGS, ROADMAP, CHANGELOG, VM-SETUP step 39) and screenshots

Federico Pereirad8cdd42f5dc9
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 7beb77f..57e2e88 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -12,6 +12,16 @@ of the matching [GitHub release](https://github.com/lordbasex/LordOS/releases),
## [0.8.4] - Unreleased
+### Added
+
+- **Settings → Appearance → «Browsers: tabs in the title bar».** One switch for both preinstalled
+ browsers: on (the default), Chromium and Firefox draw a single bar with their tabs and LordOS's
+ window buttons; off, they use the LordOS frame. It changes the setting in your own browser
+ profiles and applies the next time each browser opens; if Chromium is open, it waits until you
+ quit it. Chromium profiles from before this version that still use the LordOS frame are shown on
+ the page, with a button to change them too. A choice you made yourself in a Firefox `user.js`
+ file is left alone, and choices you make later in the browsers' own settings stick.
+
### Changed
- **Browsers with a single top bar.** Chromium and Firefox now draw their own bar, with the tabs in
@@ -22,7 +32,7 @@ of the matching [GitHub release](https://github.com/lordbasex/LordOS/releases),
LordOS frame is one switch in each browser («Use system title bar and borders» in Chromium,
«Title Bar» in Firefox), and it now applies right away, without reopening the window. Systems
upgraded from 0.8.3 get the new defaults for Firefox, and for new Chromium profiles; an existing
- Chromium profile keeps its frame until its user switches.
+ Chromium profile keeps its frame until its user switches (or uses the new switch in Settings).
### Fixed
diff --git a/docs/ROADMAP.md b/docs/ROADMAP.md
index f804dbb..e49bdd5 100644
--- a/docs/ROADMAP.md
+++ b/docs/ROADMAP.md
@@ -668,21 +668,24 @@ Details in `MAIL.md`. Tested on VM 123 against local Dovecot, Postfix and Radica
Firefox draw their own bar by default, with LordOS's window buttons (traffic lights from LordOS's
GTK theme in Chromium), and the window menu, resize edges and snap layouts keep working. See
`docs/WAYLAND.md`, "Who draws the frame".
-- [ ] **Settings → Appearance: "Browsers: tabs in the title bar" (0.8.4, proposal)** — one switch,
- on by default, that sets the browsers' own preferences for the user instead of each browser's
- settings page:
- - **Chromium:** writes `browser.custom_chrome_frame` (and `extensions.theme.system_theme` = 1, the
- GTK theme, for the traffic lights) in each profile's `Preferences` under `~/.config/chromium`,
- only while Chromium is not running (it rewrites the file on exit), through a narrow `lord.*`
- call that edits those two keys and nothing else (never a free-form JSON write);
- - **Firefox:** a `user.js` line `user_pref("browser.tabs.inTitlebar", 1|0)` in each profile under
- `~/.mozilla/firefox-esr` (read at start, so it applies the next time Firefox opens);
- - off → both go back to the LordOS frame; the page says the change applies when the browser
- restarts;
- - optional, separate: traffic lights in Firefox too. Firefox draws its window buttons itself (not
- with the GTK theme), so it would need a per-profile `chrome/userChrome.css` plus
- `toolkit.legacyUserProfileCustomizations.stylesheets`; weigh it against touching browser
- profiles before doing it.
+- [x] **Settings → Appearance: "Browsers: tabs in the title bar" (0.8.4)** — one switch, on by
+ default, that sets the browsers' own preference in the user's profiles instead of each browser's
+ settings page (`docs/WAYLAND.md`, "The switch in Settings"):
+ - **Chromium:** `browser.custom_chrome_frame` (and `extensions.theme.system_theme` = 1, the GTK
+ theme, unless the profile uses a theme extension) in each profile's `Preferences`, only while
+ Chromium is closed (if it is open, applied as soon as it quits), through the narrow
+ `lord.browserFrame` call (`hw/brframe.c`): those keys and nothing else, validated JSON before
+ and after, a backup and an atomic rename;
+ - **Firefox:** a marked `user.js` line `user_pref("browser.tabs.inTitlebar", 1|0)` in each
+ profile under `~/.config/mozilla/firefox` (where Firefox 153 puts them) and `~/.mozilla/firefox`,
+ removed again once Firefox has read it; a line the user wrote is kept;
+ - existing Chromium profiles that don't follow the switch (upgrades from 0.8.3) are counted on the
+ page, with a «Change them» button;
+ - the page says the change applies the next time each browser opens.
+- [ ] **Traffic lights in Firefox too** (optional, separate). Firefox draws its window buttons
+ itself (not with the GTK theme), so it would need a per-profile `chrome/userChrome.css` plus
+ `toolkit.legacyUserProfileCustomizations.stylesheets`; weigh it against touching browser profiles
+ before doing it.
## After the final ISO
diff --git a/docs/SETTINGS.md b/docs/SETTINGS.md
index bdd92bf..62b6ffb 100644
--- a/docs/SETTINGS.md
+++ b/docs/SETTINGS.md
@@ -293,6 +293,14 @@ and the Linux apps whose `.desktop` `MimeType` covers the category (terminals: `
![Open With](files-open-with-menu.png)
+## Appearance: «Browsers: tabs in the title bar»
+
+Not a hardware page, but its native side lives here too: `hw/brframe.c`, exposed as
+`lord.browserFrame.apply(on, 'all'|'chromium'|'firefox')`, `.state()`, `.tidy()` and
+`.chromiumRunning()` in `ui/js_hw.c`; the page is `apps/settings/BrowserFrame.jsx` (strings in
+`settings.json`, `browserTabs.*`) and the logic `sdk/browserframe.js`. It writes one preference in the
+user's own Chromium and Firefox profiles; see `WAYLAND.md`, "The switch in Settings".
+
## Admin actions
All in `server/src/hw/hw_admin.c`, in the `actions` table through `HW_ADMIN_ACTIONS`:
@@ -318,6 +326,8 @@ The validators are unit-tested in `build/settings-hw-test`.
sunset in London, Buenos Aires, Tokyo and Svalbard, schedule across midnight, zone1970.tab),
mimeapps.list editing and globs2, the power_supply reader, the admin validators. 129 checks.
- `build/bt-test` (`make test`): BlueZ parsing. 32 checks.
+- `build/brframe-test` (`make test`): the browsers' title bar switch (Chromium `Preferences`,
+ Firefox `user.js`, running browsers, hostile profile folders). 90 checks.
- `build/fan-test` (`make test`): curves, hysteresis, `fan.json`, the socket requests and the fan
driver on fake sysfs trees (see `FANS.md`).
- On VM 118: live mode changes with revert and keep, persistence across a session restart,
diff --git a/docs/VM-SETUP.md b/docs/VM-SETUP.md
index aea3b4d..11c9e95 100644
--- a/docs/VM-SETUP.md
+++ b/docs/VM-SETUP.md
@@ -1371,3 +1371,41 @@ in `~/LordOS-csd`, built there (`make -C server`, `make -C server build/deco-cli
`master_preferences` and `settings.json` restored, the themes, the schemas package, `session.conf`,
the profiles, the tree, the script and the backup removed, `lordos.service` restarted to the login
screen. No network or Proxmox setting was touched.
+
+## Step 39 — 0.8.4: the browsers' title bar switch in Settings (VM 119 `lordos-spot`, October 19)
+
+See `WAYLAND.md` ("The switch in Settings"). On VM 119 (172.17.0.54), tree in `~/LordOS-brs` (copied
+with `tar` over SSH: the VM has no `rsync`), built there (`make -C server`, `make -C server test`)
+and installed over `/usr/lib/lordos` by `~/deploy-brs-119.sh` (it saved `/usr/lib/lordos` to
+`/var/backups/lordos-brs-bak` and `settings.json` to `/var/tmp` first).
+
+- **Installed for the tests,** as in step 38: `gsettings-desktop-schemas` and `assets/gtk/LordOS*` in
+ `/usr/share/themes/` (Chromium's GTK theme needs them for the traffic lights); both removed at the
+ end.
+- **Session:** `/etc/lordos/session.conf` with `AUTOLOGIN=lord` (it didn't exist; removed at the
+ end), English and light in `settings.json` (restored at the end). A new session for the login-time
+ tidy-up: the session's `lord-server` ended, `/run/lordos/autologin-done` removed, `systemctl
+ restart lordos`.
+- **Browsers,** started from SSH in the session (`WAYLAND_DISPLAY=wayland-0`, the session bus,
+ `GSETTINGS_BACKEND=keyfile`) by `~/brs-run.sh`, quit with `SIGTERM` (Chromium) or Ctrl+Q and
+ Return through `qm monitor 119` `sendkey` (Firefox: mouse clicks don't reach it on this VM).
+ - **Chromium:** the user's `~/.config/chromium` was moved aside to `~/.config/chromium.brs-saved`
+ and a throwaway profile made by starting Chromium; it was turned into a 0.8.3-style profile
+ (`custom_chrome_frame` false) by hand, then: «Change them», the switch turned off while Chromium
+ was open (applied seconds after it quit), and a check that Chromium keeps the edited values when
+ it rewrites `Preferences`. Chromium left a stale `SingletonLock` after `SIGTERM`; it was
+ correctly ignored. At the end the throwaway profile was deleted and the saved folder put back.
+ - **Firefox:** `lord` already had two Firefox ESR profiles in `~/.config/mozilla/firefox` from
+ October 16 (not checked before the first toggle, so the switch wrote to them): `user.js` lines
+ and `user.js.lordos-backup` files, and Firefox ran three times on `eb7mmslg.default-esr` (its
+ normal session files changed; `prefs.js` got `browser.tabs.inTitlebar`). At the end LordOS's
+ files were removed from both profiles (`user.js`, `user.js.lordos-backup`; Firefox never creates a `user.js`, and both
+ backups held only LordOS's line) and the `inTitlebar` line removed from
+ `prefs.js` with Firefox closed, so it follows the default again.
+- **Input and screenshots:** `lord-qmp-input.py 119 1280 800` from the host, `screendump` holding
+ `flock /tmp/sistema-119-screen.lock`.
+- **Undone at the end:** `/usr/lib/lordos` restored from the backup (the 90 paths the deploy added
+ removed, `diff -r` against the backup empty), `settings.json` restored, `gsettings-desktop-schemas`
+ purged, the GTK themes, `session.conf`, the scripts, the tree, the backup and `/tmp/brs-*` removed,
+ `lordos.service` restarted to the login screen (the 0.8.3-era greeter kept running, as before).
+ `eth0` keeps 172.17.0.54; no network or Proxmox setting was touched.
diff --git a/docs/WAYLAND.md b/docs/WAYLAND.md
index 0382d02..00d057b 100644
--- a/docs/WAYLAND.md
+++ b/docs/WAYLAND.md
@@ -243,8 +243,9 @@ What a window with its own bar still gets from LordOS (both themes, `WINDOWS.md`
- **Upgrades** (migration `005-0.8.4-browser-frames`): where the files are still what the 0.8.3 ISO
wrote, they change to the new defaults. Firefox's is a default pref, so every profile follows it
except one whose user changed «Title Bar». Chromium's are initial preferences: only new profiles
- get them; an existing profile keeps its frame (switch as above, and Settings → Appearance → Theme →
- «Use GTK» for the traffic lights). Home folders are never touched.
+ get them; an existing profile keeps its frame until its user flips the switch below (Settings
+ shows how many Chromium profiles don't follow it, with a «Change them» button). The root
+ migration never touches home folders.
- **The LordOS GTK theme's title buttons** (`assets/gtk/LordOS*/gtk-3.0/gtk.css`): GTK sizes a title
button by its 16 px icon, and Chromium does the same when it draws its tab strip with the GTK
theme, so the button stays 16 px and the circle is a 13 px radial gradient inside it; measured on
@@ -274,6 +275,63 @@ What a window with its own bar still gets from LordOS (both themes, `WINDOWS.md`
- **The JS.** The SDK's `ThemeProvider` sends mode, accent and buttons with `lord.portal.set` when
they change.
+### The switch in Settings (0.8.4)
+
+**Settings → Appearance → «Browsers: tabs in the title bar»**, on by default. On: Chromium and
+Firefox draw one bar with their tabs and LordOS's window buttons. Off: they use the LordOS frame.
+It replaces each browser's own setting for the user, and writes that one preference in the user's
+own profiles, only when the switch is turned (never by itself at login):
+
+| | |
+|---|---|
+| ![switch](browser-switch.png) | ![pending](browser-switch-pending.png) |
+| The switch; a profile made before 0.8.4 still has the LordOS frame, «Change them» applies the switch to it | Turned off while Chromium is open: it waits, and applies as soon as Chromium quits |
+
+![off](browser-switch-off.png)
+
+*Switch off: the same Chromium profile with the LordOS frame.*
+
+- **Who writes:** `lord-server`, as the user, in C (`server/src/hw/brframe.c`, exposed as
+ `lord.browserFrame` in `ui/js_hw.c`; the page is `apps/settings/BrowserFrame.jsx`, the logic
+ `sdk/browserframe.js`). No program is run and JS passes no path: only `on`/`off` and which
+ browser. The folders are fixed (`$XDG_CONFIG_HOME` or `~/.config`, and `~`); every file is opened
+ without following links, must be a regular file owned by the user and is size-capped.
+- **Chromium** (`~/.config/chromium/Default` and `Profile N`, `Preferences`):
+ `browser.custom_chrome_frame` = on/off, and with on `extensions.theme.system_theme` = 1 (the GTK
+ theme, for the traffic lights) unless the profile uses a theme extension the user installed
+ (kept). Chromium rewrites `Preferences` when it quits, so it is only written while Chromium is
+ closed: its `SingletonLock` (`<host>-<pid>`) must be missing or stale (that pid isn't one of the
+ user's `chromium` processes; a lock from another host counts as open). If Chromium is open the
+ change waits (`settings.browserFramePending`, a check every 5 s and at login) and is applied when
+ it quits. The edit is surgical: only those values change, the rest of the file stays byte for
+ byte; the file must parse as JSON before (strict reader, `sec/json.c`) and after, with the asked
+ value in it; a malformed or unexpected file (`browser` not an object, an escaped duplicate key) is
+ left alone and reported. The previous file goes to `Preferences.lordos-backup`, then the new one
+ is written next to it (`O_EXCL`, `fsync`) and renamed over it, keeping its mode. Chromium
+ accepts the edited file (tested with Chromium 155: no reset, the value survives its own rewrite).
+- **Firefox** (`~/.config/mozilla/firefox`, where Firefox 153 makes new profiles, and the legacy
+ `~/.mozilla/firefox`; the relative profiles of `profiles.ini`): one marked line
+ `user_pref("browser.tabs.inTitlebar", 1|0); // lordos: …` in `user.js`, which Firefox reads at
+ start, so it can be written while Firefox runs (it applies when Firefox restarts). Not needed
+ when `prefs.js` already holds the value. A `user.js` line the user wrote themselves is never
+ touched («kept», and the page says so). At login `lord.browserFrame.tidy()` removes LordOS's line
+ again once Firefox has started with it (its `lock` link or `.parentlock` newer than `user.js`,
+ the profile not open: a live `.parentlock` lock or a `lock` link to a live `firefox` process), so
+ a later choice in Firefox's own «Title Bar» sticks. `prefs.js` is only read, never written.
+- **Not done:** traffic lights in Firefox too. Firefox draws its window buttons itself, so it
+ would need a per-profile `chrome/userChrome.css` and
+ `toolkit.legacyUserProfileCustomizations.stylesheets`; the roadmap keeps it as a separate item
+ to weigh first. A profile created later follows the system defaults (its own bar), not the
+ switch: turn the switch again for it.
+- **Tests:** `build/brframe-test` (`make -C server test`): the Chromium edit (missing keys, pretty
+ and compact files, strings with braces and quotes, theme extensions, idempotence, 12 malformed
+ inputs), the `user.js` line (other lines kept, the user's own line, comments, NUL bytes), and on
+ fake homes: profile discovery (`Default`/`Profile N` only, `profiles.ini` with absolute and
+ `../` paths refused), a running Chromium (a process named `chromium` holding the lock), stale and
+ foreign locks, a linked `Preferences` or `user.js` refused, backups, modes, a running Firefox
+ (`.parentlock` held, a live `lock` link) and the tidy-up rules. On VM 119 (`VM-SETUP.md`, step 39)
+ with Chromium 155 and Firefox ESR 153.
+
Tested in VM 118 with Chromium 155, Firefox ESR 153, Mousepad (GTK 3) and GNOME Calculator
(GTK 4, libadwaita); the 0.8.4 frame changes on VM 119 (`VM-SETUP.md`, step 38) with Chromium 155,
Firefox ESR 153, GTK Demo (GTK 4) and foot, both themes, light and dark.
diff --git a/docs/browser-switch-off.png b/docs/browser-switch-off.png
new file mode 100644
index 0000000..e8ef51f
Binary files /dev/null and b/docs/browser-switch-off.png differ
diff --git a/docs/browser-switch-pending.png b/docs/browser-switch-pending.png
new file mode 100644
index 0000000..8359a68
Binary files /dev/null and b/docs/browser-switch-pending.png differ
diff --git a/docs/browser-switch.png b/docs/browser-switch.png
new file mode 100644
index 0000000..29e33e9
Binary files /dev/null and b/docs/browser-switch.png differ