BASH   21

desktop-files-fix.sh

Guest on 25th May 2022 07:08:14 PM

  1. #!/bin/bash
  2. shopt -s nullglob
  3. cd /usr/share/pixmaps
  4. for FILE in ../icons/*/*/apps/*.{png,svg} ; do
  5.         rm -f ${FILE##*/}
  6. done
  7. ln -s ../icons/*/scalable/apps/*.svg . 2>/dev/null
  8. ln -s ../icons/*/48x48/apps/*.png . 2>/dev/null
  9. ln -s ../icons/*/32x32/apps/*.png . 2>/dev/null
  10. ln -s ../icons/*/24x24/apps/*.png . 2>/dev/null
  11. ln -s ../icons/*/22x22/apps/*.png . 2>/dev/null
  12. ln -s ../icons/*/16x16/apps/*.png . 2>/dev/null
  13. cd ../applications
  14. for FILE in *.desktop ; do
  15.         ICON="$(sed -n 's/^\(Icon=.*\)\(\.\(png\|svg\|xpm\)\|\)$/\1/;s/^Icon=//p' <$FILE )"
  16. #       if test -f ../pixmaps/$ICON ; then continue ; fi
  17.         if test -f ../pixmaps/$ICON.png ; then sed -i 's/^\(Icon=.*\)\(\.png\|\.svg\|\.xpm\|\)$/\1.png/' $FILE ; continue ; fi
  18.         if test -f ../pixmaps/$ICON.xpm ; then sed -i 's/^\(Icon=.*\)\(\.png\|\.svg\|\.xpm\|\)$/\1.xpm/' $FILE ; continue ; fi
  19.         if test -f ../pixmaps/$ICON.svg ; then sed -i 's/^\(Icon=.*\)\(\.png\|\.svg\|\.xpm\|\)$/\1.svg/' $FILE ; continue ; fi
  20. done

Raw Paste


Login or Register to edit or fork this paste. It's free.