diff --git a/guest/scripts/materialize-omarchy.sh b/guest/scripts/materialize-omarchy.sh index 248d837..51bf5b3 100755 --- a/guest/scripts/materialize-omarchy.sh +++ b/guest/scripts/materialize-omarchy.sh @@ -183,10 +183,20 @@ install_file 0644 "$source_dir/etc/profile.d/omarchy.sh" "$root/etc/profile.d/om install_file 0644 "$source_dir/etc/fastfetch/config.jsonc" "$root/etc/fastfetch/config.jsonc" # Preserve the application metadata and artwork used by Quickshell's real app -# provider. A single scalable hicolor location works for these demo assets. +# provider. Normalize display-style artwork names to the lowercase, hyphenated +# icon identifiers used by the desktop files and accepted by GTK's icon cache. +# The stem is normalized separately so Battle.net.png becomes battle-net.png +# rather than battle.net.png. mkdir -p "$root/usr/share/icons/hicolor/256x256/apps" while IFS= read -r icon; do - install_file 0644 "$icon" "$root/usr/share/icons/hicolor/256x256/apps/$(basename "$icon")" + icon_base=$(basename "$icon") + icon_stem=${icon_base%.*} + icon_ext=${icon_base##*.} + icon_stem=$(printf '%s' "$icon_stem" | LC_ALL=C tr '[:upper:]. ' '[:lower:]--') + icon_name="$icon_stem.$icon_ext" + icon_target="$root/usr/share/icons/hicolor/256x256/apps/$icon_name" + [[ ! -e $icon_target ]] || fail "normalized icon name collides: $icon_name" + install_file 0644 "$icon" "$icon_target" done < <(find "$source_dir/applications/icons" -maxdepth 1 -type f | sort) install_file 0644 "$source_dir/icon.png" "$root/usr/share/pixmaps/omarchy.png" install_file 0644 "$source_dir/icon.png" "$root/usr/share/icons/hicolor/256x256/apps/omarchy.png" diff --git a/guest/tests/verify.py b/guest/tests/verify.py index cd7f40a..a89d033 100755 --- a/guest/tests/verify.py +++ b/guest/tests/verify.py @@ -1120,6 +1120,57 @@ def main() -> None: "fresh-user background sorting selects the Try Omarchy wallpaper by default", ) + with tempfile.TemporaryDirectory() as temporary: + staged_root = Path(temporary) / "root" + subprocess.run( + [ + "bash", + str(GUEST / "scripts/materialize-omarchy.sh"), + "--root", + str(staged_root), + "--source", + str(source), + "--spec", + str(GUEST / "spec.json"), + ], + check=True, + text=True, + capture_output=True, + ) + staged_icons = staged_root / "usr/share/icons/hicolor/256x256/apps" + icon_names = {path.name for path in staged_icons.iterdir() if path.is_file()} + expected_normalized_icons = { + "battle-net.png", + "disk-usage.png", + "google-contacts.png", + "google-maps.png", + "google-messages.png", + "google-photos.png", + "retro-gaming.png", + } + check( + expected_normalized_icons <= icon_names + and not { + "Battle.net.png", + "battle.net.png", + "Disk Usage.png", + "Google Contacts.png", + "Google Maps.png", + "Google Messages.png", + "Google Photos.png", + "Retro Gaming.png", + } + & icon_names, + "materialized application icons match their desktop icon names", + ) + check( + all( + all(0x21 <= byte <= 0x7E for byte in os.fsencode(path.name)) + for path in staged_icons.iterdir() + ), + "materialized application icon paths are GTK cache-safe", + ) + subprocess.run( [ "python3",