Repository navigation
Add ASCII collection selection and image-folder import - #11626
TechLuddite wants to merge 8 commits into
Conversation
…ct list The screensaver renderer passes ttfx --existing-color-handling dynamic for artwork that carries SGR colour and ignore for plain text, so existing logos keep their effect gradients. An optional screensaver.effects array in shell.json limits the random rotation; names are validated before they reach ttfx and a rejected list is dropped on the next attempt. The preparer accepts SGR sequences with the attribute, 256-colour and truecolour parameter forms ttfx accepts (values up to 255, correct 38/48 arity, at most 16 parameters) and rejects every other control character. Size and line limits apply to visible text; the per-file cap is 1 MiB. Cheap line checks run before the per-character scan. omarchy-transcode-ascii gains --mode color: ImageMagick resamples to two colour samples per cell and a Python pass picks the quadrant glyph and colour pair per cell. Only the first frame of an animation is used. The image-folder importer converts in colour by default (--mode braille|block keeps the old styles) and records the mode in its manifest. Shell tests cover the SGR grammar (overflow, oversize values, arity, dangling and long parameters, OSC and cursor controls after colour), visible-text limits, quick rejection of a large over-wide file, the colour converter, per-artwork colour handling, and the effect list including non-string entries and ttfx rejection. Claude-Session: https://claude.ai/code/session_01Jp4VBCm2nK9qr2u3CrjttA
Automated AI review
Outcome: Set Image Folder rejects valid images within the documented limits. Import rejects 8-frame WebP and 48 MP photosThe policy sets Suggested change: raise Reproducer (fails at 1f20066)#!/bin/bash
set -euo pipefail
source "$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)/base-test.sh"
require_command magick
tmpdir=$(mktemp -d)
trap 'rm -rf "$tmpdir"' EXIT
mkdir -p "$tmpdir/home" "$tmpdir/animated" "$tmpdir/photo"
# An animated WebP with eight frames; the converter keeps only the first.
frames=()
for (( n = 0; n < 8; n++ )); do
magick -size 48x48 "xc:rgb($(( n * 30 )),128,128)" "$tmpdir/frame-$n.png"
frames+=("$tmpdir/frame-$n.png")
done
magick -delay 10 "${frames[@]}" "$tmpdir/animated/animated.webp"
# A 48-megapixel JPEG (8064x6048, the full-resolution size of many phone
# cameras), well under the documented 20 MiB per-image limit.
magick -size 8064x6048 gradient:red-blue -quality 85 "$tmpdir/photo/photo.jpg"
status=0
for folder in animated photo; do
if HOME="$tmpdir/home" OMARCHY_PATH="$ROOT" PATH="$ROOT/bin:$PATH" \
"$ROOT/bin/omarchy-screensaver-import" "$tmpdir/$folder" >/dev/null 2>"$tmpdir/$folder.err"; then
pass "a folder with one $folder image imports"
else
sed "s#$tmpdir#\$tmpdir#g" "$tmpdir/$folder.err" >&2
printf 'not ok - %s\n' "a folder with one $folder image imports" >&2
status=1
fi
done
exit "$status"Output at 1f20066 (ImageMagick 7.1.2-31 Q16-HDRI, exit status 1; temporary directory paths redacted to Output with Focus on no window no longer dismisses
Suggested change: return 0 only on Reproducer (fails at 1f20066)#!/bin/bash
set -euo pipefail
source "$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)/base-test.sh"
require_command jq
tmpdir=$(mktemp -d)
pid=""
cleanup() {
[[ -n $pid ]] && kill "$pid" 2>/dev/null || true
rm -rf "$tmpdir"
}
trap cleanup EXIT
mkdir -p "$tmpdir/bin" "$tmpdir/home/.config/omarchy/branding"
printf 'ART\n' >"$tmpdir/home/.config/omarchy/branding/screensaver.txt"
# Hyprland answers `activewindow -j` with {} when no window has focus, for
# example after switching to an empty workspace.
cat >"$tmpdir/bin/hyprctl" <<'SH'
#!/bin/bash
case "$1" in
activewindow) echo '{}' ;;
clients) echo '[]' ;;
esac
SH
printf '#!/bin/bash\nexec sleep 5\n' >"$tmpdir/bin/ttfx"
printf '#!/bin/bash\nexit 0\n' >"$tmpdir/bin/pgrep"
printf '#!/bin/bash\nexit 0\n' >"$tmpdir/bin/pkill"
printf '#!/bin/bash\necho /dev/pts/99\n' >"$tmpdir/bin/tty"
printf '#!/bin/bash\necho "60 160"\n' >"$tmpdir/bin/stty"
chmod +x "$tmpdir/bin/"*
# Keep stdin open and silent, so only the focus check can end the screensaver.
exec {silence}< <(sleep 10)
HOME="$tmpdir/home" OMARCHY_PATH="$ROOT" PATH="$tmpdir/bin:$ROOT/bin:$PATH" TMPDIR="$tmpdir" \
"$ROOT/bin/omarchy-screensaver" <&"$silence" >/dev/null 2>&1 &
pid=$!
for (( attempt = 0; attempt < 40; attempt++ )); do
kill -0 "$pid" 2>/dev/null || break
sleep 0.1
done
if kill -0 "$pid" 2>/dev/null; then
fail "screensaver exits when focus moves to no window"
fi
pid=""
pass "screensaver exits when focus moves to no window"Output at 1f20066 (exit status 1): Output at the merge-base 31bd80d (exit status 0): Output at 1f20066 with More findingsEdit Text, Set From Image and Restore Default now depend on
|
Address the community review of 1f20066: - Allow animated WebP with up to 128 frames and bound large inputs in every converter mode, so phone-camera photos import. A failed import names the image in its error and notification. - Dismiss the screensaver when focus moves to no window. Only a failed hyprctl call or a non-object reply counts as still focused. - Write shell.json from Edit Text, Set From Image and Restore Default only when a collection is selected. - Count only regular files against the 128-image cap. Add a live acceptance test for collection playback and dismissal, and update the manual for colour mode, input formats and import limits.
Response to the community review@llstrk's automated review of 1f20066 found four real defects. All four reproduced locally and are fixed in 5e28e86, along with the optional test and documentation notes. Fixes
The branding test now asserts the converter's Second review before pushingAn adversarial review of these fixes found one regression in my first version: shrinking to four times the output size before trimming erased small logos on large canvases. The fixed 2048 px box replaced it. One behaviour is unchanged. While Testing
I have not reconciled this branch with #13083, #11732, #13631, #13647 or #12258, which touch the same lines. I can rebase onto whichever lands first. AI processThis update was made with AI assistance, and I approved it before pushing.
Test scope: source, sandbox and live Hyprland tests on Omarchy, using ImageMagick 7.1.2-31 Q16-HDRI, jq 1.8.2 and Python 3.14.7. |
|
Address the Greptile review of 5e28e86: - An image that disappears, is replaced or cannot be opened after the scan now fails the import instead of selecting a partial collection. Missing or replaced files report that the folder changed, other open errors report their reason. - A conversion timeout names the image, and an exhausted batch budget is reported as such rather than blamed on one image. - The live acceptance test now finds the colour artwork's own colour on screen while a single colour effect runs.
Response to the Greptile reviewAll three findings on 5e28e86 hold. They are fixed in 7b72ba6.
Testing
AI processThis update was made with AI assistance, and I approved it before pushing.
Test scope: source, sandbox and live Hyprland tests on Omarchy, using ImageMagick 7.1.2-31 Q16-HDRI and Python 3.14.7. |
|
Feature looks thoughtful (collections + image import). Product call: is multi-collection screensaver in scope for quattro, or should this stay a plugin? Also please call out how import validates/limits image paths (size, symlink, ownership) so we don't grow a surprise write surface. |
|
Hi @jandrusk, thank you for kind response. This one had been on my mind, as it's been open for some time. I wouldn't be surprised if there's 100 cooler screensaver plugins already live on the OPR, and that is the best home for such things. I'd rather not clog up the pipeline with this work. Thank you again! |
Omarchy currently animates one branding file. This adds Set Text Folder for existing artwork and Set Image Folder for a one-time PNG/JPEG/WebP import. Collections advance after each complete native
ttfxeffect and wrap in order. With noscreensaver.source, the existing live-editable branding file still works.Image import reuses
omarchy-transcode-ascii, adds a colour quadrant-block mode, and saves a text snapshot under~/.local/share/omarchy/screensavers/import-*. Colour artwork retains its colours; plain text keeps the effect's gradients. Playback uses the full native random effect rotation.Successful single-image, edit-text and reset actions clear the collection selection. Cancelled selection or failed import preserves it. Configuration writes preserve symlinked dotfiles and file permissions. Renderer cleanup targets owned effect children and validated screensaver windows; idle and lock timing are unchanged.
Collections are treated as data: bounded descriptor-based reads, private snapshots, strict SGR-only colour validation, and rejection of links, special files and other terminal controls. Batch image decoding has raster-signature checks, restricted ImageMagick coders/delegates, resource limits and deadlines. Original artwork and previous imports are retained.
Validation:
test/acceptance.d/screensaver-test.shon one 1920x1200 display (Hyprland 0.56.2): collection playback, colour handling, dismissal on an empty workspace and by a key, and cleanup. The stock launcher across several monitors and a full automatic idle-to-lock cycle remain unverified for this revision.config,locate,snapper,unowned-system-paths), all of which also fail on clean base31bd80don the test machine. This is not an all-green full-suite claim.No screenshots, recordings or third-party artwork are included.