Last active
October 25, 2019 07:57
-
-
Save 4piu/ebd1d13275affeac099d9adc221d571f to your computer and use it in GitHub Desktop.
This script converts and changes the Jetbrains app icons in desktop file to png, in order to fix missing icon in the Application laucher of KDE Plasma
This file contains 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
#!/bin/bash | |
# This script converts and changes the Jetbrains app icons to png in order to fix missing icon in the Application laucher of KDE Plasma | |
IFS=$(echo -en "\n\b") | |
DESKTOP=~/.local/share/applications/jetbrains-*.desktop | |
if ! [ -x "$(command -v convert)" ]; then | |
echo 'Error: ImageMagick is not installed. ' >&2 | |
exit 1 | |
fi | |
for file in $DESKTOP | |
do | |
echo -e "\nProcessing $(basename ${file})" | |
svg=`grep -Poi '(?<=Icon=).+' ${file}` | |
if [[ ${svg##*.} != "svg" ]]; then | |
echo "Not SVG icon, skipped: ${svg}" | |
continue | |
fi | |
png=${svg%%.svg}.png | |
if [[ -f "${png}" ]]; then | |
echo "'Image convert skipped: file exists '${png}'" | |
else | |
echo "Converting '${svg}' to '${png}'" | |
convert -density 1200 -resize 200 -background none ${svg} ${png} | |
fi | |
sed -i "s|${svg}|${png}|g" ${file} | |
done | |
echo -e "\nJob done. " | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment