Skip to content

Rewrite on modern Node with per-monitor wallpapers, CI and release workflows - #1

Merged
MarcelMichau merged 5 commits into
masterfrom
rewrite/modern-node
Oct 23, 2026
Merged

MarcelMichau merged 5 commits into
masterfrom
rewrite/modern-node

Conversation

@MarcelMichau

@MarcelMichau MarcelMichau commented Oct 23, 2026 •

Copy link
Copy Markdown
Owner

Summary

Rewrites wallangle on modern Node, replacing its unmaintained dependencies. It now generates and sets a separate wallpaper for each monitor at its native resolution. Adds CI and tag-driven npm and GitHub releases.

 dependencies
-  trianglify@3    # pulls in canvas (native, node-gyp), jsdom@7, natives, chroma-js@0.6
-  wallpaper@4
-  minimist
+  delaunator@5    # triangulation
+  chroma-js@3     # colour scales + ColorBrewer palettes
cli.mjs                     # parse flags → per monitor: generate → encode → set → clean up old files
lib/
├── options.mjs             # util.parseArgs + validation
├── random.mjs              # seeded RNG (cyrb128 + sfc32)
├── generate.mjs            # jittered grid → Delaunay → LAB gradient → 2x supersampled fill
├── png.mjs                 # PNG encoder on node:zlib
└── wallpaper/
    ├── windows.mjs         # IDesktopWallpaper COM via PowerShell
    └── macos.mjs           # NSWorkspace via JXA (osascript)
.github/workflows/
├── ci.yml                  # tests: windows + macos × Node 22.2.0 / LTS / current
└── release.yml             # on v* tag: tests → npm publish (trusted publishing) → GitHub release

Every run prints its seed. The seed now drives every random choice (variance, cell size, palette, points), so --seed=<value> recreates the same wallpapers.

Evidence

  • Before: trianglify@3.0.0 depends on canvas, jsdom@^7, natives and chroma-js@^0.6, and has had no release since 2022. Wallpapers were always 3840×2160, written to the current directory, and the same image was used on every monitor.
    After: all 10 npm test tests pass. They include a check that every pixel of the output is covered exactly once, at variance 0–1 and odd image sizes. A real run on Windows with two monitors (portrait + ultrawide):
$ node cli.mjs --seed=helloworld
Wallpaper generated & set with seed helloworld:
  Monitor 1: 1440x2560, variance 0.554, cellSize 95, colors PiYG
  Monitor 2: 3440x1440, variance 0.056, cellSize 57, colors RdBu
Run again with --seed=helloworld to recreate it.

After the run, IDesktopWallpaper reported a different file for each monitor, and after 12 runs only the files from the 10 most recent runs remained. Generating and encoding a 4K image takes about 0.3 s; a full run takes about 1.8 s, most of it PowerShell startup.

  • Not yet verified: the macOS backend has only been written, not run. The CI Monitor detection (macos-latest) job is its first real run, and it is non-blocking because hosted runners may have no display.

Merge Danger

Door: two-way

Merging does not publish anything. Publishing 2.0.0 happens only when a v2.0.0 tag is pushed, and that step is one-way: an npm version can't be reused.

Blast Radius: major-version

When 2.0.0 is published, these users are affected:

  • Node < 22.2 and Linux users can no longer install it (engines and os fields).
  • --width/--height now default to each monitor's resolution, not 3840×2160.
  • --cellSize must be an integer ≥ 10.
  • Images now go to %LOCALAPPDATA%\wallangle or ~/Library/Application Support/wallangle instead of the current directory.
  • Old seeds produce different images.
  • On macOS, only the current Space is changed.

🤖 Generated with Claude Code

MarcelMichau and others added 5 commits October 23, 2026 17:16
replace trianglify, wallpaper and minimist with maintained delaunator + chroma-js
render triangles with a 2x supersampled scanline fill and encode png with node zlib
generate one wallpaper per monitor at its native resolution
set wallpapers via IDesktopWallpaper on windows and NSWorkspace (JXA) on macos
derive all random choices from the seed and print it so wallpapers can be recreated
accept colorbrewer palette names for --colors and validate all flags
store wallpapers in the app data folder and remove the previous run's files
add node:test suite
require node >= 22.2 and bump package major version

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
run tests on windows and macos across node 22.2.0, lts and current
add non-blocking monitor detection smoke check on real runners
publish to npm via trusted publishing and create github release on version tags
normalise package.json repository url for npm provenance

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
keep wallpapers from the 10 most recent runs instead of deleting all but the current run, so inactive macos spaces and overlapping runs keep their files
draw every seeded default before applying overrides, so overriding one flag no longer changes the others
add tests for parameter selection and wallpaper pruning

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
move cli logic to lib/main.mjs and load it dynamically from cli.mjs after a version check
npx installs regardless of engines.node, and older node versions otherwise fail with a cryptic missing zlib.crc32 export error
add a test keeping the minimum version in sync with engines.node
add a ci job asserting the error on node 20

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@MarcelMichau
MarcelMichau merged commit d8b2907 into master Oct 23, 2026
9 checks passed
@MarcelMichau
MarcelMichau deleted the rewrite/modern-node branch October 23, 2026 15:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant