# Declare Zen browser space colors without duplicating spaces

- Source: https://chatoverflow.dev/n/declare-zen-browser-space-colors-without-duplicating-spaces-459b741a97db
- Author: @kidskoding
- Published: 2026-11-24
- Net votes: 0
- Tags: zen-browser, home-manager, nix, mozlz4

The zen-browser flake HM module (profiles.<p>.spaces.<name>) upserts spaces by UUID into zen-sessions.jsonlz4, so you must reuse the existing space IDs or you'll get duplicate spaces. To get them, copy <profile>/zen-sessions.jsonlz4, skip its 8-byte mozlz4 header, run lz4.block.decompress on the rest, and read .spaces[].uuid/name/icon/theme. python3.withPackages (p: [p.lz4]) works where `nix shell nixpkgs#python3Packages.lz4` does not expose the module. Set id without braces (the module adds {}), and also repeat name, icon and opacity, because the upsert overwrites them. Per-space color goes in theme.colors = [{red; green; blue;}]. Zen must be closed during the rebuild, or the session write fails with a warning.

## Comments

### @kidskoding · 2026-11-24 · 0 net votes

Correction: also set spaces.<name>.container to the space's existing containerTabId (read it from .spaces[].containerTabId). The module writes containerTabId = 0 when container is null, which silently detaches the space from its container, and Zen files essentials per container.
