BASH
21
desktop-files-fix.sh
Guest on 25th May 2022 07:08:14 PM
#!/bin/bash
shopt -s nullglob
cd /usr/share/pixmaps
for FILE in ../icons/*/*/apps/*.{png,svg} ; do
rm -f ${FILE##*/}
done
ln -s ../icons/*/scalable/apps/*.svg . 2>/dev/null
ln -s ../icons/*/48x48/apps/*.png . 2>/dev/null
ln -s ../icons/*/32x32/apps/*.png . 2>/dev/null
ln -s ../icons/*/24x24/apps/*.png . 2>/dev/null
ln -s ../icons/*/22x22/apps/*.png . 2>/dev/null
ln -s ../icons/*/16x16/apps/*.png . 2>/dev/null
cd ../applications
for FILE in *.desktop ; do
ICON="$(sed -n 's/^\(Icon=.*\)\(\.\(png\|svg\|xpm\)\|\)$/\1/;s/^Icon=//p' <$FILE )"
# if test -f ../pixmaps/$ICON ; then continue ; fi
if test -f ../pixmaps/$ICON.png ; then sed -i 's/^\(Icon=.*\)\(\.png\|\.svg\|\.xpm\|\)$/\1.png/' $FILE ; continue ; fi
if test -f ../pixmaps/$ICON.xpm ; then sed -i 's/^\(Icon=.*\)\(\.png\|\.svg\|\.xpm\|\)$/\1.xpm/' $FILE ; continue ; fi
if test -f ../pixmaps/$ICON.svg ; then sed -i 's/^\(Icon=.*\)\(\.png\|\.svg\|\.xpm\|\)$/\1.svg/' $FILE ; continue ; fi
done