sovereign_browser (Rust)
A Linux x86 web browser built on WebKitGTK and Rust, designed around
sovereign identity instead of the traditional web's permissioned
infrastructure. Identity, messaging, and relay operations are handled through
Nostr, powered by the local
rust_core_lib workspace crates.
Note: This project is a port to Rust from the original C99 project
Sovereign_Browser. The Nostr functionality previously provided by the C librarynostr_core_libis now provided by the Rust workspace crates (nostr_core,nostr_relay,nostr_nips,nostr_signer,nostr_services).
Features
- WebKitGTK-based browser shell with tabs, bookmarks, history, and search
- Sovereign identity via Nostr keys (local + nsigner support)
- Custom
nostr://andlocal://URL schemes - Tor integration (
tor_control+tor_scheme) - Built-in agent system: chat, conversations, skills, tools, MCP, LLM bridge, and an agent server
- Site downloader and offline content embedding
- FIPS / process / profile / settings management UIs
Architecture
The browser is organized into the following modules (see src/lib.rs):
- Browser shell —
tab_manager,menu,session,web_context,webkit_data - Nostr integration —
nostr_bridge,nostr_inject,nostr_scheme,nostr_url,relay_fetch,key_store - Agent system —
agent_loop,agent_chat,agent_conversations,agent_skills,agent_tools,agent_mcp,agent_server,agent_llm - Services —
tor_control,net_services,site_downloader,settings_sync,fips_control
Building
Requirements: Rust (stable), GTK3, WebKitGTK 4.1, and the local
rust_core_lib workspace at /home/user/lt/nostr_core_lib_rust.
cargo build --release
Or use run.sh, which builds only when sources changed and then
launches the browser (./run.sh for debug, ./run.sh --release for the
optimized build).
Known issues
Qubes software-rendering flag causes ~200% CPU per idle window
On Qubes OS, when the software-rendering qube service is enabled, Qubes
creates /var/run/qubes-service/software-rendering, and
/etc/profile.d/qubes-gui.sh exports LIBGL_ALWAYS_SOFTWARE=1,
GSK_RENDERER=cairo, GDK_DISABLE="gl vulkan", and
GDK_DEBUG="gl-disable vulkan-disable" into every session.
WebKitGTK then composites every window through Mesa's llvmpipe CPU
rasterizer instead of the GPU. Each WebKitWebProcess spawns 8 llvmpipe
worker threads plus a busy ThreadedCompositor, burning ~200% CPU per
open window even when idle (observed: 3 idle windows ≈ 450% combined CPU
in htop, while the main sovereign_browser process sat at ~4%).
Two gotchas make this easy to misdiagnose:
- The env vars are sticky: they are exported at login. Removing the flag file does not clean already-open terminals, so relaunching from an old shell silently re-poisons the browser.
- The flag file is not persistent:
/var/runis tmpfs, so the file returns on every qube restart while the qube-level service is enabled.
Mitigation (in run.sh): before launching, run.sh checks
for the flag file. If it is absent, it strips the four stale variables so
the browser can use the GPU even from a poisoned shell. If the flag is
present, the qube's software-rendering choice is honored. Set
SOVEREIGN_KEEP_SOFTWARE_RENDERING=1 to skip the guard (e.g. to test the
software path).
Permanent fix (dom0): disable the service at the qube level:
qvm-service <qube-name> software-rendering off
Second layer — NVIDIA had no EGL vendor ICD. Even with the env vars
stripped, WebKit 2.52 does WebGL through ANGLE → EGL, and its
compositor prefers EGL/dmabuf. The NVIDIA driver packages were
installed for GLX only — libEGL_nvidia and its GLVND vendor JSON were
missing, so every EGL enumeration resolved to Mesa → llvmpipe. Idle pages
looked fine, but any page creating a WebGL context (e.g. the 3D view on
the homedesigner site) spawned 8 busy llvmpipe threads at ~250% CPU.
Fix (applied on this machine):
sudo apt-get install nvidia-egl-icd libnvidia-egl-gbm1
This drops 10_nvidia.json into /usr/share/glvnd/egl_vendor.d/ and
installs libEGL_nvidia.so.0; eglinfo then reports
EGL vendor string: NVIDIA / GTX 1080 Ti. The binary's guard
(src/main.rs) only sets
WEBKIT_DISABLE_DMABUF_RENDERER=1 (GLX fallback) when the NVIDIA EGL
vendor is missing; with the ICD installed, WebKit uses the native
EGL/dmabuf path on the GPU. SOVEREIGN_ALLOW_DMABUF_RENDERER=1 skips the
fallback check entirely.
Diagnosing: if idle windows burn CPU again, check
ls /var/run/qubes-service/software-rendering # flag present?
env | grep -E 'LIBGL|GSK' # poisoned shell?
for p in $(pgrep -f WebKitWebProcess); do
echo "PID $p: $(ps -Lo comm -p "$p" | grep -c llvmpipe) llvmpipe threads"
done
llvmpipe threads live in the WebKitWebProcess renderers, not in the
main sovereign_browser process — checking the main process always reads
0 and can mask a poisoned launch. A freshly launched browser can also look
healthy for the first minute (pages still loading) before the CPU climbs.
0 across all renderers means the GPU path is active. The browser's own
Processes page (sovereign://processes, with the perf probe enabled in
Settings) shows per-tab cpu_busy_percent if you need to identify which
tab is heavy.
Note: with the GLX fallback active, renderers may still map Mesa EGL
libraries and show 8 llvmpipe threads — that is fine as long as the
threads are idle (0% CPU in top -H) and libnvidia-glcore is also in
the renderer's /proc/<pid>/maps. Busy llvmpipe threads mean WebGL fell
back to the CPU; check that WEBKIT_DISABLE_DMABUF_RENDERER=1 is set in
the WebProcess environment.
License
MIT