fix(cli): resolve bundled icons at runtime so icons setup works in release builds - #351
Open
angelodibella wants to merge 1 commit into
Open
Conversation
…release builds
`icons setup` located the bundled icons with a compile-time path
(`env!("CARGO_MANIFEST_DIR")/../resources/...`). In CI-built release
binaries that bakes in the build workspace, so every packaged install
(release tarball, AUR wayle-bin) fails with:
Error: Resources directory not found: /__w/wayle/wayle/wayle/../resources/icons/hicolor/scalable/actions
even though the release archive ships the icons right next to the
binary. With setup broken there is no way to refresh stale icons, which
bites hard across the grappa v1 -> v2 icon format change: v1 icons left
on disk render as filled-in silhouettes under a v2-era shell.
Resolve the resources directory at runtime instead, first match wins:
1. <exe_dir>/icons/... - extracted release archive layout
2. /usr/share/wayle and /usr/local/share/wayle - distro packages that
install the shipped icons/ directory
3. the CARGO_MANIFEST_DIR path - development builds (cargo run)
The error message now lists every searched location.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
wayle icons setupis broken in every packaged build. It locates the bundled icons with a compile-time path (env!("CARGO_MANIFEST_DIR")/../resources/...), which in CI-built release binaries bakes in the runner's workspace:This fails even though the release archive ships the icons right next to the binary, and it means packaged installs (release tarball, AUR
wayle-bin) have no way to install or refresh the bundled set.The practical fallout is worse than a failed command: users who set up icons under an older version and then upgraded across the grappa v1 → v2 icon format change are left with stale stroke-based v1 SVGs on disk, which a v2-era shell renders as filled-in silhouettes (bluetooth rune with its counters filled, night-light reduced to a dot) — with no supported way to fix it.
Fix
Resolve the resources directory at runtime, first existing candidate wins:
<exe_dir>/icons/hicolor/scalable/actions— extracted release-archive layout/usr/share/wayle/…and/usr/local/share/wayle/…— distro packages that install the shippedicons/directoryCARGO_MANIFEST_DIRpath — development builds (cargo runfrom a checkout), unchanged behaviorOn no match, the error now lists every searched location instead of one baked-in path.
Testing
cargo check/cargo clippy -p wayleclean,cargo fmtappliedXDG_DATA_HOME)icons/tree (candidate 1): resolves exe-relative and installswayle-bin0.7.0 install fixed the mangled-icon rendering described aboveNote for packagers
With candidate 2 in place, distro packages can simply install the release archive's
icons/directory to/usr/share/wayle/andwayle icons setupwill find it (the AURwayle-binPKGBUILD currently drops theicons/directory entirely — I'll flag that to its maintainer separately).