Repository navigation
Sample only the first frame when picking bar text color - #8925
chessing234 wants to merge 4 commits into
Conversation
Multi-frame wallpapers (GIF/video) made ImageMagick decode every frame before the crop and could exhaust system memory.
There was a problem hiding this comment.
Pull request overview
Limits wallpaper sampling to the first frame to prevent excessive resource use.
Changes:
- Adds ImageMagick memory limits and a 10-second timeout.
- Adds a multi-frame GIF regression test.
Tip
If you aren't ready for review, convert to a draft PR.
Click "Convert to draft" or run gh pr ready --undo.
Click "Ready for review" or run gh pr ready to reengage.
Reviewed changes
Copilot reviewed 1 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
bin/omarchy-bar-text-color |
Samples frame zero with bounded memory and execution time. |
test/shell.d/bar-text-color-test.sh |
Adds multi-frame sampling coverage. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| magick -size 100x100 xc:'#f5f5f5' -fill '#202020' -draw 'rectangle 0,0 99,19' \ | ||
| \( -size 100x100 xc:'#00ff00' \) \( -size 100x100 xc:'#0000ff' \) "$multi_frame" | ||
| result=$(HOME="$TMPDIR" omarchy-bar-text-color top 20 '#ffffff' '#101010' --background "$multi_frame" --screen 100x100) | ||
| [[ $result == "#ffffff" ]] || fail "transparent bar text samples only the first frame of a multi-frame background" "expected #ffffff, got $result" | ||
| pass "transparent bar text samples only the first frame of a multi-frame background" |
Frame 0 was dark-topped, so the correct answer was #ffffff — the same value fallback() prints when sampling fails. Without the [0] selector the pipeline emits one triple per frame, "32,32,320,255,00,0,255", which the regex guard rejects, so the script fell back to #ffffff and the assertion passed on unfixed code. Removing [0] and rerunning the suite confirmed it: 4 passed. Light-topping frame 0 makes the expected result #101010, which fallback() cannot produce. The same mutation now fails with "expected #101010, got #ffffff". Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
Reviewed at bffe2de, with a second opinion from Codex at xhigh reasoning. One real problem, and it is in the test rather than the fix. I pushed the correction to this branch as e4037c6; everything else here holds up. The new test passed on unfixed code. Frame 0 was dark-topped ( The guard at The three things the fix does, checked separately on a disposable VM running ImageMagick 7.1.2-30 Q16-HDRI, the build Omarchy ships:
One pre-existing thing worth knowing, not introduced here. A fallback is sticky. Tests ran on the VM, never locally: Codex agreed with the test finding, which I had already reached by mutation, so read that agreement with the caveat that its independence is not currently guaranteed; the One for the maintainer rather than for you: #8307 rewrites the same |
|
folding into #12115 with the other bar panel fixes |
Summary
omarchy-bar-text-colornow samples${background}[0]under memory/time bounds so multi-frame wallpapers (GIF/video) cannot decode every frame and exhaust RAM (omarchy-bar-text-color decodes every frame of a multi-frame background, exhausting system memory #8906).Test plan
test/shell.d/bar-text-color-test.shwith a multi-frame GIF fixture (CI).current/backgroundat an animated GIF/video with a transparent bar and confirm RSS stays bounded.Fixes #8906