25 lines
589 B
Bash
Executable File
25 lines
589 B
Bash
Executable File
#!/usr/bin/env bash
|
|
set -e
|
|
FULL_PREFIX="$(realpath -s "$1")"
|
|
HASH_PREFIX=($(echo "$FULL_PREFIX" | md5sum))
|
|
DESKTOP_FILE="$2"
|
|
|
|
if ! [ -f "$DESKTOP_FILE" ]; then
|
|
if [ -f "$HOME/.local/share/applications/$HASH_PREFIX-$2.desktop" ]; then
|
|
DESKTOP_FILE="$HOME/.local/share/applications/$HASH_PREFIX-$2.desktop"
|
|
fi
|
|
fi
|
|
|
|
while IFS="" read -r p || [ -n "$p" ]
|
|
do
|
|
shopt -s nullglob
|
|
if [[ "$p" == "Icon="* ]]; then
|
|
ICON="${p/Icon=/}"
|
|
for ICON_FILE in "$HOME/.icons/hicolor/"*"/"*"/$ICON."*; do
|
|
rm -f "$ICON_FILE"
|
|
done
|
|
fi
|
|
shopt -u nullglob
|
|
done < "$DESKTOP_FILE"
|
|
rm -f "$DESKTOP_FILE"
|