Complete the Panama theme system

This commit is contained in:
Gabriel Brown
2026-08-20 22:03:08 -04:00
parent 69ecec7ecf
commit ed428e87c4
17 changed files with 1370 additions and 41 deletions
+13 -13
View File
@@ -8,7 +8,8 @@
# inside Panama's own surfaces, which look correct either way.
#
# Three things have to line up, and none of them share a source:
# - config/Theme.qml carries the accent table with its `gnome` member
# - services/ThemeProfileModel.js carries the accent table with its `gnome`
# member (Theme.qml exposes it; the theme-profile system owns it)
# - scripts/panama-theme-apps maps the same names in shell
# - the portal routes Settings to a backend that can serve accent-color
#
@@ -17,7 +18,7 @@
set -uo pipefail
repo_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
theme="$repo_dir/config/dot/quickshell/config/Theme.qml"
accents="$repo_dir/config/dot/quickshell/services/ThemeProfileModel.js"
script="$repo_dir/config/dot/quickshell/scripts/panama-theme-apps"
portals="$repo_dir/config/dot/xdg-desktop-portal/hyprland-portals.conf"
@@ -26,25 +27,24 @@ fail() {
exit 1
}
for path in "$theme" "$script" "$portals"; do
for path in "$accents" "$script" "$portals"; do
[[ -r "$path" ]] || fail "missing $path"
done
# ── The accent table ─────────────────────────────────────────────────────────
mapping="$(python3 - "$theme" <<'PYTHON'
mapping="$(python3 - "$accents" <<'PYTHON'
import re, sys
source = open(sys.argv[1]).read()
table = re.search(r"readonly property var accents: \(\{(.*?)\n \}\)", source, re.S)
table = re.search(r"var CURATED = \{(.*?)\n\};", source, re.S)
if not table:
raise SystemExit("accents table not found")
for line in table.group(1).splitlines():
name = re.search(r'"([a-z]+)":', line)
if not name:
continue
member = re.search(r'gnome: "([a-z]+)"', line)
print(name.group(1) + "\t" + (member.group(1) if member else ""))
raise SystemExit("curated accent table not found")
# Each accent is a multi-line record now, so the name opens a block and the
# member may be several lines below it.
for entry in re.finditer(r"\n ([a-z]+): \{(.*?)\n \}", table.group(1), re.S):
member = re.search(r'gnome: "([a-z]+)"', entry.group(2))
print(entry.group(1) + "\t" + (member.group(1) if member else ""))
PYTHON
)" || fail 'could not read the accent table from Theme.qml'
)" || fail 'could not read the curated accent table from ThemeProfileModel.js'
[[ -n "$mapping" ]] || fail 'the accent table is empty'