$ show zen-browser/desktop
This repository is the source code for the Zen Browser, a Firefox-based desktop browser focused on productivity and customization. The codebase is a heavily modified Firefox fork that adds custom features such as workspaces (called Spaces), visual page boosts (duotone color filters), split-view tabs, glance previews, tab folders, compact mode, live folders, and a device sync system for workspace/folder/tab state. The architecture is a monolithic browser application built on top of the Gecko engine, with custom C++ XPCOM components for platform-specific functionality (e.g., native window dragging, mouse tracking for compact mode, color filter backend using Oklab color space) and JavaScript modules for the UI layer. The project includes an extensive test suite covering session restore, sync engines, shell integration, and pixel-level boost validation. It relies on upstream Firefox source code (patched via .patch files) and external services like Firefox Sync and Remote Settings. The codebase demonstrates strong engineering with well-organized custom modules, reusable test infrastructure, and a focus on state persistence and synchronization, though it carries the inherent complexity and coupling of a browser fork.
The LLM identified 4 files worth highlighting for reuse:
Implements the core color transformation pipeline for Zen Boosts (duotone/invert effects). Uses Oklab color space for perceptually uniform blending, includes a small round-robin LRU accent cache keyed by (nscolor, rotation) to avoid redundant GPU work, and provides fast approximations for cube root and smoothstep. This component is self-contained in its color math and could be extracted as a general-purpose color filter library, though it depends on Gecko's nscolor type.
Provides a full mock Sync HTTP server (SyncServer class) with handlers for storage, info, and authentication endpoints. Supports user registration, collection management, and introspection via callbacks (onCollectionDeleted, onItemDeleted, onRequest). Includes helper factories (sync_httpd_setup, serverForUsers). This is a highly reusable test infrastructure component that could be adapted to test any RESTful sync protocol with minimal changes.
Manages the association between workspaces (Spaces) and bookmarks using a SQLite table within Firefox's Places database. Implements change tracking via a separate changes table for sync, with idempotent insert/update/delete operations and a batch application pattern. The module is self-contained and could be extracted as a generic workspace-bookmark storage layer for any browser-based project.
A Rust CLI tool that reads YAML preference definitions (with conditions, placeholders like @IS_TWILIGHT@) and generates C++ and JS files for static and dynamic browser preferences. It replaces manual editing of preference files and ensures consistency between build configurations. This is a self-contained code generation pattern that could be reused in any project needing type-safe, conditional preference management from YAML sources.