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.

Browsers draw their own bar by default, with LordOS's window buttons

Federico Pereira2fa20720ab2f
diff --git a/packaging/migrations/005-0.8.4-browser-frames.sh b/packaging/migrations/005-0.8.4-browser-frames.sh
new file mode 100644
index 0000000..07fe54c
--- /dev/null
+++ b/packaging/migrations/005-0.8.4-browser-frames.sh
@@ -0,0 +1,42 @@
+# 0.8.4: the preinstalled browsers draw their own bar, with LordOS's window buttons in it (traffic
+# lights through LordOS's GTK theme), instead of the LordOS frame on top (docs/WAYLAND.md, "Frame
+# and colors"). The ISO up to 0.8.3 wrote the opposite defaults; this changes them where they are
+# still exactly what LordOS wrote, so an administrator's own choice stays:
+#
+# - /etc/chromium/master_preferences: "custom_chrome_frame": false → true, and the GTK theme
+# ("extensions": {"theme": {"system_theme": 1}}) when the file sets no "extensions" yet. These are
+# initial preferences: they only reach Chromium profiles created from now on.
+# - /etc/firefox-esr/lordos.js, if it is still the file the ISO wrote: inTitlebar 0 → 1. A default
+# pref, so every profile follows it except one whose user changed «Title Bar» (a user_pref, kept).
+#
+# Home folders are never touched: an existing Chromium profile keeps the frame it had; its user
+# switches with a right click on the tab strip → «Use system title bar and borders» off, and
+# Settings → Appearance → Theme → «GTK». LORDOS_MIGRATION_ROOT is for tests only.
+R=${LORDOS_MIGRATION_ROOT:-}
+
+CH="$R/etc/chromium/master_preferences"
+if [ -f "$CH" ] && grep -q '"custom_chrome_frame": false' "$CH"; then
+ t=$(mktemp "$CH.XXXXXX")
+ sed 's/"custom_chrome_frame": false/"custom_chrome_frame": true/' "$CH" > "$t"
+ if ! grep -q '"extensions"' "$t"; then
+ # the file is a JSON object written one key per line (json.dump indent=2): the GTK theme
+ # goes in as its first key
+ sed '1s/^{$/{\n "extensions": {\n "theme": {\n "system_theme": 1\n }\n },/' "$t" > "$t.2" && mv "$t.2" "$t"
+ fi
+ chmod 644 "$t"
+ mv "$t" "$CH"
+fi
+
+FF="$R/etc/firefox-esr/lordos.js"
+OLD_FF='// LordOS: Firefox windows use the system frame (the theme frame); change it in
+// Customize Toolbar > Title Bar, or in about:config.
+pref("browser.tabs.inTitlebar", 0);'
+if [ -f "$FF" ] && [ "$(cat "$FF")" = "$OLD_FF" ]; then # exactly the file the ISO wrote
+ t=$(mktemp "$FF.XXXXXX")
+ printf '%s\n' '// LordOS: Firefox draws its own bar, with the window buttons in LordOS'"'"'s order (see' \
+ '// docs/WAYLAND.md); 0 gives it the LordOS frame instead (Customize Toolbar > Title Bar).' \
+ 'pref("browser.tabs.inTitlebar", 1);' > "$t"
+ chmod 644 "$t"
+ mv "$t" "$FF"
+fi
+exit 0
diff --git a/tools/iso/build.sh b/tools/iso/build.sh
index 3b961fc..d5fd335 100755
--- a/tools/iso/build.sh
+++ b/tools/iso/build.sh
@@ -43,7 +43,7 @@ PKGS_LORDOS="libwayland-server0 libwayland-client0 libxkbcommon0 xkb-data pipewi
PKGS_FIRMWARE="firmware-amd-graphics firmware-misc-nonfree firmware-iwlwifi firmware-realtek firmware-atheros
firmware-sof-signed"
PKGS_GPU="libgl1-mesa-dri libegl1 libgles2 libgbm1 mesa-vulkan-drivers mesa-utils vulkan-tools glmark2-es2-wayland"
-# preinstalled browsers (Linux apps; they use the LordOS frame by default, see docs/WAYLAND.md)
+# preinstalled browsers (Linux apps; they draw their own bar with LordOS's window buttons, see docs/WAYLAND.md)
PKGS_APPS="foot featherpad qt6-wayland chromium firefox-esr"
# the disk installer (server/src/install): partition, format, copy and grub for UEFI and BIOS
PKGS_INSTALLER="gdisk dosfstools e2fsprogs squashfs-tools util-linux grub-common grub2-common grub-efi-amd64-bin grub-pc-bin"
@@ -98,22 +98,25 @@ in_ch apt-get install -y -q --no-install-recommends $PKGS_BASE $PKGS_LORDOS $PKG
>> "$WORK/apt.log" 2>&1 || { tail -30 "$WORK/apt.log"; exit 1; }
cp "$DEB" "$CH/tmp/lordos.deb"
in_ch apt-get install -y -q --no-install-recommends /tmp/lordos.deb >> "$WORK/apt.log" 2>&1 || { tail -30 "$WORK/apt.log"; exit 1; }
-# Chromium: new profiles with the system frame (LordOS's) instead of its own bar
+# Chromium: new profiles draw their own bar (tabs in the title bar) with the GTK theme, so the
+# window buttons are LordOS's traffic lights from LordOS's GTK theme (docs/WAYLAND.md). The user
+# goes back to the LordOS frame with «Use system title bar and borders» (Settings → Appearance).
if [ -f "$CH/etc/chromium/master_preferences" ]; then
python3 - "$CH/etc/chromium/master_preferences" <<'PY'
import json, sys
p = sys.argv[1]; d = json.load(open(p))
-d.setdefault("browser", {})["custom_chrome_frame"] = False
+d.setdefault("browser", {})["custom_chrome_frame"] = True
+d.setdefault("extensions", {}).setdefault("theme", {})["system_theme"] = 1 # 1 = GTK
json.dump(d, open(p, "w"), indent=2)
PY
fi
-# Firefox ESR: same (the user changes it in Customize Toolbar > Title Bar)
+# Firefox ESR: its own bar too (the user changes it in Customize Toolbar > Title Bar)
install -D -m 644 tools/iso/rootfs/etc/wireplumber/wireplumber.conf.d/lordos-bluez.conf "$CH/etc/wireplumber/wireplumber.conf.d/lordos-bluez.conf"
install -D -m 644 tools/iso/rootfs/etc/pipewire/pipewire-pulse.conf.d/lordos-no-modules.conf "$CH/etc/pipewire/pipewire-pulse.conf.d/lordos-no-modules.conf"
install -d "$CH/etc/firefox-esr"
-printf '%s\n' '// LordOS: Firefox windows use the system frame (the theme frame); change it in' \
- '// Customize Toolbar > Title Bar, or in about:config.' \
- 'pref("browser.tabs.inTitlebar", 0);' > "$CH/etc/firefox-esr/lordos.js"
+printf '%s\n' '// LordOS: Firefox draws its own bar, with the window buttons in LordOS'"'"'s order (see' \
+ '// docs/WAYLAND.md); 0 gives it the LordOS frame instead (Customize Toolbar > Title Bar).' \
+ 'pref("browser.tabs.inTitlebar", 1);' > "$CH/etc/firefox-esr/lordos.js"
rm -f "$CH/tmp/lordos.deb"
# 3. configuration