Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01As1S7fpDqEDnZxcGbSSoUW
noctalia-cosmic-theme
Keeps the COSMIC desktop theme in sync with your active Noctalia palette — so COSMIC's native apps (Files, Settings, Terminal, Store, the panel and applets) match everything else Noctalia themes (GTK, Qt, KDE, kitty, …).
Noctalia ships templates for GTK/Qt/KDE but not COSMIC. This bridges the gap
using COSMIC's own cosmic-settings appearance import, which compiles and
hot-applies a theme RON.
How it works
Noctalia palette change (builtin / community / custom / wallpaper)
│ Noctalia rewrites ~/.config/gtk-{3,4}.0/noctalia.css last, once the
▼ palette is fully resolved — that's the trigger.
cosmic-noctalia-sync.path → cosmic-noctalia-sync.service
│ waits for the GTK CSS mtime to go quiet, then:
▼
resolve-palette.sh active palette → normalized Material-3 tokens
▼ (custom/community palette JSON, else the live GTK4 render)
build-ron.py → a COSMIC theme RON
▼
cosmic-settings appearance import → COSMIC recompiles + applies live
Works for every Noctalia palette source. Custom and community palettes are
read straight from their M3 JSON; builtin and wallpaper-generated schemes are
read back from the GTK4 file Noctalia renders for them (it exposes primary,
error, surface, on_surface, surface_container, plus success / warning
used as secondary / tertiary). The watcher keys on that GTK file precisely
because it is written after the switch settles — keying on settings.toml
raced ahead of the colours and left non-custom schemes a switch behind.
Palette mapping
| COSMIC | ← Noctalia M3 |
|---|---|
bg_color, neutral_0/1 |
surface |
primary_container_bg |
surface_container (derived if absent) |
secondary_container_bg |
surface_container_high |
neutral ramp 2..9 |
interpolated surface → surface_variant → outline → on_surface |
neutral_10, text_tint |
on_surface |
accent, success |
primary |
neutral_tint |
outline |
destructive |
error |
warning |
tertiary |
Layout (spacing, corner_radii, alpha_map, frosting) stays at COSMIC defaults.
Install
git clone <this repo> ~/Projects/noctalia-cosmic-theme
cd ~/Projects/noctalia-cosmic-theme
# one-off apply
./noctalia-cosmic-sync
# auto-sync on every palette change
cp systemd/cosmic-noctalia-sync.{service,path} ~/.config/systemd/user/
systemctl --user daemon-reload
systemctl --user enable --now cosmic-noctalia-sync.path
For the auto-sync to catch builtin / wallpaper schemes, keep Noctalia's GTK 3
and GTK 4 templates enabled (Settings → Theme → Templates, or
builtin_ids = [ …, "gtk3", "gtk4" ] in config.toml).
Adjust the %h/Projects/noctalia-cosmic-theme path in the .service if you
cloned elsewhere.
Requires
cosmic-settings (COSMIC 1.7+), python3, noctalia.
Native Noctalia template (experimental)
template.toml + cosmic.env + apply.sh are a Noctalia community-template
package for the day Noctalia's user/community template engine reliably fires on
palette change (it didn't in 5.0.0-beta.9 — hence the watcher above). Drop the
dir into Noctalia's template path and add "cosmic" to your enabled templates.