2021-10-26 11:26:39 +02:00
|
|
|
#!/bin/sh -e
|
2022-08-11 14:15:20 +02:00
|
|
|
# Removes unused icons from the Adwaita theme. It could be even more aggressive,
|
|
|
|
# since it keeps around lots of sizes and all the GTK+ stock icons.
|
2021-10-26 11:26:39 +02:00
|
|
|
export LC_ALL=C
|
|
|
|
find share/icons/Adwaita -type f | awk 'BEGIN {
|
|
|
|
while (("grep -aho \"[a-z][a-z-]*\" *.dll *.exe" | getline) > 0)
|
|
|
|
good[$0] = 1
|
|
|
|
} /[.](png|svg|cur|ani)$/ {
|
|
|
|
# Cut out the basename without extensions
|
|
|
|
match($0, /[^\/]+$/)
|
|
|
|
base = substr($0, RSTART)
|
|
|
|
sub(/[.].+$/, "", base)
|
|
|
|
|
|
|
|
# Try matching while cutting off suffixes
|
2021-11-01 02:40:41 +01:00
|
|
|
# Disregarding the not-much-used GTK_ICON_LOOKUP_GENERIC_FALLBACK
|
2021-10-26 11:26:39 +02:00
|
|
|
while (!(keep = good[base]) &&
|
|
|
|
sub(/-(ltr|rtl|symbolic)$/, "", base)) {}
|
|
|
|
if (!keep)
|
|
|
|
print
|
2022-08-11 14:15:20 +02:00
|
|
|
}' | xargs rm --
|