From bdd10798f9355bbf8335132f49e6f5c6a62b6453 Mon Sep 17 00:00:00 2001 From: xscriptor Date: Tue, 10 Nov 2026 14:59:24 +0100 Subject: [PATCH] Fix install links and add validation --- .github/workflows/ci.yml | 60 ++++++++++++++++++ README.md | 4 +- scripts/validate.py | 106 ++++++++++++++++++++++++++++++++ windhawk/taskbar/generate.py | 96 ++++------------------------- yasb/README.md | 2 +- yasb/install.ps1 | 2 +- yasb/splited/berlin/README.md | 2 +- yasb/splited/bogota/README.md | 2 +- yasb/splited/helsinki/README.md | 2 +- yasb/splited/lahabana/README.md | 2 +- yasb/splited/london/README.md | 2 +- yasb/splited/madrid/README.md | 2 +- yasb/splited/miami/README.md | 2 +- yasb/splited/oslo/README.md | 2 +- yasb/splited/paris/README.md | 2 +- yasb/splited/praha/README.md | 2 +- yasb/splited/tokio/README.md | 2 +- yasb/splited/x/README.md | 2 +- zebar/README.md | 2 +- zebar/install.ps1 | 2 +- 20 files changed, 197 insertions(+), 101 deletions(-) create mode 100644 .github/workflows/ci.yml create mode 100644 scripts/validate.py diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..123110c --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,60 @@ +name: Validate themes + +on: + pull_request: + push: + branches: + - main + +permissions: + contents: read + +concurrency: + group: validate-${{ github.ref }} + cancel-in-progress: true + +jobs: + validate: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.12" + + - name: Install validation tools + run: python -m pip install PyYAML==6.0.2 + + - name: Regenerate theme files + run: | + python3 yasb/generate.py + python3 zebar/generate-palettes.py + python3 windhawk/taskbar/generate.py + + - name: Check generated files are committed + run: | + git diff --exit-code + test -z "$(git status --porcelain)" + + - name: Validate assets and documentation + run: python3 scripts/validate.py + + - name: Validate PowerShell syntax + run: | + pwsh -NoProfile -Command ' + $failed = $false + Get-ChildItem -Recurse -Filter *.ps1 | ForEach-Object { + $tokens = $null + $errors = $null + [System.Management.Automation.Language.Parser]::ParseFile($_.FullName, [ref]$tokens, [ref]$errors) | Out-Null + if ($errors.Count -gt 0) { + Write-Host "Syntax errors in $($_.FullName)" + $errors | ForEach-Object { Write-Host $_ } + $failed = $true + } + } + if ($failed) { exit 1 } + ' diff --git a/README.md b/README.md index e473dc7..e6031f7 100644 --- a/README.md +++ b/README.md @@ -82,8 +82,8 @@ Xscriptor palette ecosystem. the app if missing and deploy the theme packs from the repo: ```powershell -irm https://raw.githubusercontent.com/xscriptor-colors/windows/main/windows/yasb/install.ps1 | iex # YASB only -irm https://raw.githubusercontent.com/xscriptor-colors/windows/main/windows/zebar/install.ps1 | iex # Zebar only +irm https://raw.githubusercontent.com/xscriptor-colors/windows/main/yasb/install.ps1 | iex # YASB only +irm https://raw.githubusercontent.com/xscriptor-colors/windows/main/zebar/install.ps1 | iex # Zebar only ``` **Or clone and deploy locally**: diff --git a/scripts/validate.py b/scripts/validate.py new file mode 100644 index 0000000..88d1dcd --- /dev/null +++ b/scripts/validate.py @@ -0,0 +1,106 @@ +#!/usr/bin/env python3 +"""Validate Windows theme assets and documentation links. + +Checks JSON and YAML syntax and verifies that relative Markdown links resolve. +PowerShell syntax is validated separately in CI with the PowerShell parser. +""" + +from __future__ import annotations + +import json +import re +import sys +from pathlib import Path +from urllib.parse import unquote, urlparse + +try: + import yaml +except ImportError: # pragma: no cover - local convenience + yaml = None + +ROOT = Path(__file__).resolve().parents[1] +SKIP_DIRS = {".git", "__pycache__"} +LINK_RE = re.compile(r"(? list[Path]: + files = [] + for path in ROOT.rglob(f"*{suffix}"): + if path.is_file() and not any(part in SKIP_DIRS for part in path.relative_to(ROOT).parts): + files.append(path) + return sorted(files) + + +def check_json(path: Path) -> str | None: + try: + with path.open(encoding="utf-8") as f: + json.load(f) + except (OSError, json.JSONDecodeError) as exc: + return f"{path.relative_to(ROOT)}: {exc}" + return None + + +def check_yaml(path: Path) -> str | None: + if yaml is None: + return None + try: + with path.open(encoding="utf-8") as f: + yaml.safe_load(f) + except (OSError, yaml.YAMLError) as exc: + return f"{path.relative_to(ROOT)}: {exc}" + return None + + +def check_links(path: Path) -> list[str]: + issues = [] + text = path.read_text(encoding="utf-8", errors="replace") + for raw in LINK_RE.findall(text) + HREF_RE.findall(text): + target = unquote(raw.strip().split(" ", 1)[0]) + parsed = urlparse(target) + if parsed.scheme or target.startswith(("#", "//", "/")): + continue + clean = target.split("#", 1)[0].split("?", 1)[0] + if not clean: + continue + destination = (path.parent / clean).resolve() + try: + destination.relative_to(ROOT.resolve()) + except ValueError: + continue + if not destination.exists(): + issues.append(f"{path.relative_to(ROOT)}: broken link {target!r}") + return issues + + +def main() -> int: + errors: list[str] = [] + checked = 0 + + for path in iter_files(".json"): + checked += 1 + error = check_json(path) + if error: + errors.append(error) + for path in iter_files(".yaml") + iter_files(".yml"): + checked += 1 + error = check_yaml(path) + if error: + errors.append(error) + for path in iter_files(".md"): + checked += 1 + errors.extend(check_links(path)) + + print(f"Validated {checked} files.") + if errors: + print("\nValidation failed:", file=sys.stderr) + for error in errors: + print(f" {error}", file=sys.stderr) + return 1 + + print("All checked files are valid.") + return 0 + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/windhawk/taskbar/generate.py b/windhawk/taskbar/generate.py index 157e86e..77c3f78 100644 --- a/windhawk/taskbar/generate.py +++ b/windhawk/taskbar/generate.py @@ -1,11 +1,9 @@ #!/usr/bin/env python3 -"""Generate windhawk/taskbar/xscriptor/*.json from the canonical PALETTES. +"""Generate windhawk/taskbar/dock/*.json from the canonical PALETTES. -Base: the xdark taskbar style (rounded 13px buttons) remapped per palette — -the gold accent (#facc15) is replaced by each palette's own differentiating -color on the clock, tray text, labels, running indicator and foregrounds, -and the solid black button/tray backgrounds are replaced by each palette's -`background` color. The Start button is hidden in every variant. +Dock-style taskbar themes: a floating centered pill, with each palette's +accent on borders, running indicator and labels, and its `background` color +behind the pill. The Start button is hidden in every variant. The transparent glass layout is kept as a one-off copy in glassx.json (not touched by this script). Usage: python generate.py @@ -18,8 +16,6 @@ HERE = os.path.dirname(os.path.abspath(__file__)) REPO = os.path.dirname(os.path.dirname(HERE)) GEN = os.path.join(REPO, "yasb", "generate.py") -OUT_DIR = os.path.join(HERE, "xscriptor") - spec = importlib.util.spec_from_file_location("yasb_gen", GEN) yasb = importlib.util.module_from_spec(spec) spec.loader.exec_module(yasb) @@ -43,66 +39,6 @@ "bogota": "#47e6ff", } -# xdark base template, with $accent in place of the gold #facc15 and the -# Start button collapsed (no Windows icon). -TEMPLATE = { - "theme": "xdark", - "controlStyles[0].target": "Taskbar.TaskListButton", - "controlStyles[0].styles[0]": "CornerRadius=13", - "controlStyles[0].styles[1]": "Padding=6,0,6,0", - "controlStyles[0].styles[2]": "HorizontalContentAlignment=Left", - "resourceVariables[0].variableKey": "", - "resourceVariables[0].value": "", - "controlStyles[1].target": "SystemTray.TextIconContent > Grid#ContainerGrid > SystemTray.AdaptiveTextBlock#Base > TextBlock#InnerTextBlock", - "controlStyles[1].styles[0]": "FontSize=16", - "controlStyles[1].styles[1]": "Foreground=$accent", - "controlStyles[2].target": "SystemTray.NotifyIconView#NotifyItemIcon", - "controlStyles[2].styles[0]": "MinWidth=25", - "controlStyles[3].target": "SystemTray.OmniButton#ControlCenterButton > Grid > ContentPresenter > ItemsPresenter > StackPanel > ContentPresenter[1] > SystemTray.IconView > Grid > Grid", - "controlStyles[3].styles[0]": "Visibility=Collapsed", - "controlStyles[4].target": "SystemTray.TextIconContent > Grid#ContainerGrid", - "controlStyles[4].styles[0]": "Padding=2", - "controlStyles[5].target": "SystemTray.ChevronIconView", - "controlStyles[5].styles[0]": "MinWidth=27", - "controlStyles[6].target": "SystemTray.OmniButton#NotificationCenterButton > Grid > ContentPresenter > ItemsPresenter > StackPanel > ContentPresenter > SystemTray.IconView#SystemTrayIcon > Grid > Grid > SystemTray.TextIconContent", - "controlStyles[6].styles[0]": "Visibility=Collapsed", - "controlStyles[7].target": "Taskbar.TaskListLabeledButtonPanel > Border#BackgroundElement", - "controlStyles[7].styles[0]": "Background=$bg", - "controlStyles[8].target": "Grid#SystemTrayFrameGrid", - "controlStyles[8].styles[0]": "Background=$bg", - "controlStyles[8].styles[1]": "CornerRadius=13", - "controlStyles[8].styles[2]": "Margin=0,5,4,5", - "controlStyles[8].styles[3]": "Padding=2,0,-18,0", - "controlStyles[9].target": "Taskbar.TaskListButton > Grid > Rectangle#RunningIndicator", - "controlStyles[9].styles[0]": "Height=3", - "controlStyles[9].styles[1]": "RadiusX=1.5", - "controlStyles[9].styles[2]": "RadiusY=1.5", - "controlStyles[9].styles[3]": "Fill@ActiveNormal=$accent", - "controlStyles[9].styles[4]": "VerticalAlignment=Bottom", - "controlStyles[9].styles[5]": "Margin=16,0,16,4", - "controlStyles[9].styles[6]": "StrokeThickness=0", - "controlStyles[10].target": "SystemTray.ImageIconContent > Grid#ContainerGrid > Image", - "controlStyles[10].styles[0]": "Width=13", - "controlStyles[11].target": "SystemTray.TextIconContent > Grid#ContainerGrid > SystemTray.AdaptiveTextBlock#Base > TextBlock#InnerTextBlock", - "controlStyles[11].styles[0]": "FontSize=13", - "controlStyles[11].styles[1]": "Foreground=$accent", - "controlStyles[12].target": "TextBlock#LabelControl", - "controlStyles[12].styles[0]": "FontFamily=Segoe UI Medium", - "controlStyles[12].styles[1]": "Foreground=$accent", - "controlStyles[12].styles[2]": "Margin=1,0,0,0", - "controlStyles[12].styles[3]": "VerticalAlignment=Center", - "controlStyles[12].styles[4]": "TextWrapping=NoWrap", - "controlStyles[13].target": "Taskbar.ExperienceToggleButton#LaunchListButton[AutomationProperties.AutomationId=StartButton]", - "controlStyles[13].styles[0]": "Visibility=Collapsed", - "controlStyles[15].target": "Taskbar.TaskbarFrame > Grid#RootGrid > Taskbar.TaskbarBackground > Grid > Rectangle#BackgroundFill", - "controlStyles[15].styles[0]": "Fill=Transparent", - "controlStyles[16].target": "Rectangle#BackgroundStroke", - "controlStyles[16].styles[0]": "Fill=Transparent", - "controlStyles[18].target": "SystemTray.TextIconContent > Grid#ContainerGrid > SystemTray.AdaptiveTextBlock#Base > TextBlock#InnerTextBlock", - "controlStyles[18].styles[0]": "Foreground=$accent", -} - - X_BG = "#050505" # X is the hand-tuned base palette. # Dock-like template (apps sit on a floating centered pill, no button boxes), @@ -166,9 +102,9 @@ def with_alpha(color, alpha): def main(): - os.makedirs(OUT_DIR, exist_ok=True) dock_dir = os.path.join(HERE, "dock") os.makedirs(dock_dir, exist_ok=True) + for pid in ORDER: accent = ACCENTS[pid] bg = X_BG if pid == "x" else yasb.PALETTES[pid]["background"] @@ -178,20 +114,14 @@ def main(): "$accent": accent, "$bg": bg, } - for name, template, out_dir in ( - ("xdark", TEMPLATE, OUT_DIR), - ("dock", DOCK_TEMPLATE, dock_dir), - ): - data = { - key: value for key, value in template.items() - } - for token, color in ctx.items(): - data = {key: value.replace(token, color) for key, value in data.items()} - path = os.path.join(out_dir, "{}.json".format(pid)) - with open(path, "w") as f: - json.dump(data, f, indent=2) - f.write("\n") - print("wrote", path, "accent", accent, "bg", bg) + data = dict(DOCK_TEMPLATE) + for token, color in ctx.items(): + data = {key: value.replace(token, color) for key, value in data.items()} + path = os.path.join(dock_dir, "{}.json".format(pid)) + with open(path, "w") as f: + json.dump(data, f, indent=2) + f.write("\n") + print("wrote", path, "accent", accent, "bg", bg) if __name__ == "__main__": diff --git a/yasb/README.md b/yasb/README.md index db0aa65..ad99404 100644 --- a/yasb/README.md +++ b/yasb/README.md @@ -43,7 +43,7 @@ Requires [YASB](https://github.com/amnweb/yasb) (`winget install AmN.yasb`) and **Remote** (no git needed — installs YASB if missing, then deploys): ```powershell -irm https://raw.githubusercontent.com/xscriptor-colors/windows/main/windows/yasb/install.ps1 | iex +irm https://raw.githubusercontent.com/xscriptor-colors/windows/main/yasb/install.ps1 | iex ``` **Or locally from this folder:** diff --git a/yasb/install.ps1 b/yasb/install.ps1 index 266628a..bd5d338 100644 --- a/yasb/install.ps1 +++ b/yasb/install.ps1 @@ -6,7 +6,7 @@ YASB theme pack remotely without git or manual copying. Remote one-liner (PowerShell 5.1+): - irm https://raw.githubusercontent.com/xscriptor-colors/windows/main/windows/yasb/install.ps1 | iex + irm https://raw.githubusercontent.com/xscriptor-colors/windows/main/yasb/install.ps1 | iex Or from a saved file: powershell -ExecutionPolicy Bypass -File install.ps1 diff --git a/yasb/splited/berlin/README.md b/yasb/splited/berlin/README.md index 801a38f..2f797bc 100644 --- a/yasb/splited/berlin/README.md +++ b/yasb/splited/berlin/README.md @@ -39,7 +39,7 @@ berlin/ Styles the system (taskbar, start menu, notification center, file explorer, settings, borders, corners and menus) with the Berlin palette. -→ [View the installation guide](./windhawk/setup.md) +→ [View the installation guide](../../../windhawk/README.md) ## YASB diff --git a/yasb/splited/bogota/README.md b/yasb/splited/bogota/README.md index 7ba412b..743c025 100644 --- a/yasb/splited/bogota/README.md +++ b/yasb/splited/bogota/README.md @@ -39,7 +39,7 @@ bogota/ Styles the system (taskbar, start menu, notification center, file explorer, settings, borders, corners and menus) with the Bogota palette. -→ [View the installation guide](./windhawk/setup.md) +→ [View the installation guide](../../../windhawk/README.md) ## YASB diff --git a/yasb/splited/helsinki/README.md b/yasb/splited/helsinki/README.md index e583817..3ed4b16 100644 --- a/yasb/splited/helsinki/README.md +++ b/yasb/splited/helsinki/README.md @@ -39,7 +39,7 @@ helsinki/ Styles the system (taskbar, start menu, notification center, file explorer, settings, borders, corners and menus) with the Helsinki palette. -→ [View the installation guide](./windhawk/setup.md) +→ [View the installation guide](../../../windhawk/README.md) ## YASB diff --git a/yasb/splited/lahabana/README.md b/yasb/splited/lahabana/README.md index 1f22407..f0f0544 100644 --- a/yasb/splited/lahabana/README.md +++ b/yasb/splited/lahabana/README.md @@ -39,7 +39,7 @@ lahabana/ Styles the system (taskbar, start menu, notification center, file explorer, settings, borders, corners and menus) with the Lahabana palette. -→ [View the installation guide](./windhawk/setup.md) +→ [View the installation guide](../../../windhawk/README.md) ## YASB diff --git a/yasb/splited/london/README.md b/yasb/splited/london/README.md index a10a481..559d9f3 100644 --- a/yasb/splited/london/README.md +++ b/yasb/splited/london/README.md @@ -39,7 +39,7 @@ london/ Styles the system (taskbar, start menu, notification center, file explorer, settings, borders, corners and menus) with the London palette. -→ [View the installation guide](./windhawk/setup.md) +→ [View the installation guide](../../../windhawk/README.md) ## YASB diff --git a/yasb/splited/madrid/README.md b/yasb/splited/madrid/README.md index dae6dd5..7c3caaf 100644 --- a/yasb/splited/madrid/README.md +++ b/yasb/splited/madrid/README.md @@ -39,7 +39,7 @@ madrid/ Styles the system (taskbar, start menu, notification center, file explorer, settings, borders, corners and menus) with the Madrid palette. -→ [View the installation guide](./windhawk/setup.md) +→ [View the installation guide](../../../windhawk/README.md) ## YASB diff --git a/yasb/splited/miami/README.md b/yasb/splited/miami/README.md index 97181a1..62744c2 100644 --- a/yasb/splited/miami/README.md +++ b/yasb/splited/miami/README.md @@ -39,7 +39,7 @@ miami/ Styles the system (taskbar, start menu, notification center, file explorer, settings, borders, corners and menus) with the Miami palette. -→ [View the installation guide](./windhawk/setup.md) +→ [View the installation guide](../../../windhawk/README.md) ## YASB diff --git a/yasb/splited/oslo/README.md b/yasb/splited/oslo/README.md index 19dfc83..810071e 100644 --- a/yasb/splited/oslo/README.md +++ b/yasb/splited/oslo/README.md @@ -39,7 +39,7 @@ oslo/ Styles the system (taskbar, start menu, notification center, file explorer, settings, borders, corners and menus) with the Oslo palette. -→ [View the installation guide](./windhawk/setup.md) +→ [View the installation guide](../../../windhawk/README.md) ## YASB diff --git a/yasb/splited/paris/README.md b/yasb/splited/paris/README.md index c12109a..1e9f745 100644 --- a/yasb/splited/paris/README.md +++ b/yasb/splited/paris/README.md @@ -39,7 +39,7 @@ paris/ Styles the system (taskbar, start menu, notification center, file explorer, settings, borders, corners and menus) with the Paris palette. -→ [View the installation guide](./windhawk/setup.md) +→ [View the installation guide](../../../windhawk/README.md) ## YASB diff --git a/yasb/splited/praha/README.md b/yasb/splited/praha/README.md index e68f10b..02a845b 100644 --- a/yasb/splited/praha/README.md +++ b/yasb/splited/praha/README.md @@ -39,7 +39,7 @@ praha/ Styles the system (taskbar, start menu, notification center, file explorer, settings, borders, corners and menus) with the Praha palette. -→ [View the installation guide](./windhawk/setup.md) +→ [View the installation guide](../../../windhawk/README.md) ## YASB diff --git a/yasb/splited/tokio/README.md b/yasb/splited/tokio/README.md index 81c41a4..e192114 100644 --- a/yasb/splited/tokio/README.md +++ b/yasb/splited/tokio/README.md @@ -39,7 +39,7 @@ tokio/ Styles the system (taskbar, start menu, notification center, file explorer, settings, borders, corners and menus) with the Tokio palette. -→ [View the installation guide](./windhawk/setup.md) +→ [View the installation guide](../../../windhawk/README.md) ## YASB diff --git a/yasb/splited/x/README.md b/yasb/splited/x/README.md index 0970677..c44f716 100644 --- a/yasb/splited/x/README.md +++ b/yasb/splited/x/README.md @@ -39,7 +39,7 @@ x/ Styles the system (taskbar, start menu, notification center, file explorer, settings, borders, corners and menus) with the X palette. -→ [View the installation guide](./windhawk/setup.md) +→ [View the installation guide](../../../windhawk/README.md) ## YASB diff --git a/zebar/README.md b/zebar/README.md index 322f567..65b40e0 100644 --- a/zebar/README.md +++ b/zebar/README.md @@ -32,7 +32,7 @@ Requires [WebView2](https://developer.microsoft.com/en-us/microsoft-edge/webview **Remote** (no git needed — installs Zebar if missing, then deploys): ```powershell -irm https://raw.githubusercontent.com/xscriptor-colors/windows/main/windows/zebar/install.ps1 | iex +irm https://raw.githubusercontent.com/xscriptor-colors/windows/main/zebar/install.ps1 | iex ``` **Or locally from this folder:** diff --git a/zebar/install.ps1 b/zebar/install.ps1 index db09f48..db2bc3d 100644 --- a/zebar/install.ps1 +++ b/zebar/install.ps1 @@ -6,7 +6,7 @@ Zebar widget packs remotely without git or manual copying. Remote one-liner (PowerShell 5.1+): - irm https://raw.githubusercontent.com/xscriptor-colors/windows/main/windows/zebar/install.ps1 | iex + irm https://raw.githubusercontent.com/xscriptor-colors/windows/main/zebar/install.ps1 | iex Or from a saved file: powershell -ExecutionPolicy Bypass -File install.ps1