-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add missing icons to .local/share/icons for Linux #74
Comments
I would like to second this. --Edit--Explination of what i did prior to creating the script further down.in the spirit of "I'll do it myself", after doing "Apply with BOOP" on all of my games that were missing icons. --TL;DR--Now someone needs to write a script that does the following:
--Script-Progress--i think i nailed it. Shell Script#!/usr/bin/env bash
shopt -s nullglob
OVERWRITE_EXISTING_ICONS="false"
STEAM_ASSET_PATH="$HOME/.local/share/Steam/appcache/librarycache/"
TMPFILE_PATH="/tmp/IMAGES_TO_MODIFY/"
if ! command -v basename >/dev/null 2>&1
then
UTIL_EXISTS="0"
fi
if ! command -v identify >/dev/null 2>&1
then
UTIL_EXISTS="0"
fi
if ! command -v mogrify >/dev/null 2>&1
then
UTIL_EXISTS="0"
fi
if [ "$UTIL_EXISTS" == "0" ]
then
if exists apt
then
PACKAGE_MANAGER="apt"
elif exists dnf
then
PACKAGE_MANAGER="dnf"
elif exists yum
then
PACKAGE_MANAGER="yum"
elif exists pacman
then
PACKAGE_MANAGER="pacman"
fi
echo "WARNING: Missing 'imagemagick' and/or 'coreutils', attempting to detect system package manager and then install the missing packages..."
case "$PACKAGE_MANAGER" in
"apt")
echo "Detected apt..."
sudo apt update
sudo apt install coreutils imagemagick
;;
"dnf")
echo "Detected dnf..."
sudo dnf upgrade
sudo dnf install coreutils ImageMagick
;;
"yum")
echo "Detected yum..."
sudo yum update
sudo yum install coreutils ImageMagick
;;
"pacman")
echo "Detected pacman..."
sudo pacman -Syu
sudo pacman -Sy imagemagick coreutils
;;
*)
echo "ERROR: Unable to detect package manager..."
echo "please find and install 'basename', possibly a part of 'coreutils' and, 'identify' and 'mogrify', possibly a part of 'imagemagick', according to your distributions instructions"
exit 1
;;
esac
if ! command -v basename >/dev/null 2>&1
then
echo "ERROR: Still missing 'basename' and/or 'coreutils', please find the package containing it and use your system package manager to install the missing package..."
exit 1
fi
if ! command -v identify >/dev/null 2>&1
then
echo "ERROR: Still missing 'identify' and/or 'imagemagick', please find the package containing it and use your system package manager to install the missing package..."
exit 1
fi
if ! command -v mogrify >/dev/null 2>&1
then
echo "ERROR: Still missing 'mogrify' and/or 'imagemagick', please find the package containing it and use your system package manager to install the missing package..."
exit 1
fi
fi
mkdir -p -v "$TMPFILE_PATH"
FILES=$(find "$STEAM_ASSET_PATH" -name "*_icon.*")
for F in $FILES
do
IMG_FORMAT="$(file -i -b "$F" | sed -e 's/;.*//')"
IMG_FORMAT="${IMG_FORMAT//image\/}"
BASENAME_NO_EXT="$(basename "${F%.*}")"
case "$IMG_FORMAT" in
"png")
echo "$(basename "$F") is already in .png format, moving it to ${TMPFILE_PATH}$(basename "$F") and then renaming it to .png"
cp -v -T "$F" "${TMPFILE_PATH}${BASENAME_NO_EXT}.png"
;;
"jpeg")
echo "$(basename "$F") is not in .png format, moving it to ${TMPFILE_PATH}$(basename "$F") and then converting to .png"
cp -v -T "$F" "${TMPFILE_PATH}${BASENAME_NO_EXT}.jpg"
mogrify -quiet -auto-orient -format png "${TMPFILE_PATH}${BASENAME_NO_EXT}.jpg"
rm -v "${TMPFILE_PATH}${BASENAME_NO_EXT}.jpg"
;;
"vnd.microsoft.icon")
echo "$(basename "$F") is not in .png format, moving it to ${TMPFILE_PATH}$(basename "$F") and then converting to .png"
cp -v -T "$F" "${TMPFILE_PATH}${BASENAME_NO_EXT}.ico"
mogrify -quiet -auto-orient -format png "${TMPFILE_PATH}${BASENAME_NO_EXT}.ico"
rm -v "${TMPFILE_PATH}${BASENAME_NO_EXT}.ico"
;;
"x-tga")
echo "$(basename "$F") is not in .png format, moving it to ${TMPFILE_PATH}$(basename "$F") and then converting to .png"
cp -v -T "$F" "${TMPFILE_PATH}${BASENAME_NO_EXT}.tga"
mogrify -quiet -auto-orient -format png "${TMPFILE_PATH}${BASENAME_NO_EXT}.tga"
rm -v "${TMPFILE_PATH}${BASENAME_NO_EXT}.tga"
;;
*)
echo "$F has unknown image format $IMG_FORMAT"
;;
esac
done
PNG_FILES=$(find "$TMPFILE_PATH" -name "*.png")
for P in $PNG_FILES
do
IMG_WIDTH="$(identify -format '%w' "$P")"
IMG_HEIGHT="$(identify -format '%h' "$P")"
NO_DIGIT_FILENAME="$(basename "$P" | sed "s/-[[:digit:]]\+//")"
NO_ICON_FILENAME="${NO_DIGIT_FILENAME//_icon/}"
FULL_NEW_FILENAME="steam_icon_$NO_ICON_FILENAME"
NEW_PATHNAME="$HOME/.local/share/icons/hicolor/${IMG_WIDTH}x${IMG_HEIGHT}/apps/"
FINAL_FILENAME="${NEW_PATHNAME}${FULL_NEW_FILENAME}"
echo "$(basename "$P") is ${IMG_WIDTH}x${IMG_HEIGHT}"
if ! [ -e "$NEW_PATHNAME" ]
then
mkdir -p -v "$NEW_PATHNAME"
fi
echo "Moving $(basename "$P") to $NEW_PATHNAME"
if [ "${OVERWRITE_EXISTING_ICONS,,}" == "false" ] || [ "${OVERWRITE_EXISTING_ICONS,,}" == "no" ] || [ "$OVERWRITE_EXISTING_ICONS" == "0" ]
then
mv -v -n "$P" "$FINAL_FILENAME"
if [ -e "$FINAL_FILENAME" ]
then
echo "$FINAL_FILENAME already exists, skipping..."
rm -v "$FINAL_FILENAME"
fi
elif [ "${OVERWRITE_EXISTING_ICONS,,}" != "false" ] && [ "${OVERWRITE_EXISTING_ICONS,,}" != "no" ] && [ "$OVERWRITE_EXISTING_ICONS" != "0" ]
then
if [ -e "$FINAL_FILENAME" ]
then
echo "$FINAL_FILENAME already exists, overwriting..."
elif ! [ -e "$FINAL_FILENAME" ]
then
echo "$FINAL_FILENAME doesnt exist, continuing..."
fi
mv -v -f "$P" "$FINAL_FILENAME"
fi
done
rmdir -v "$TMPFILE_PATH"
if [ -e "$TMPFILE_PATH" ]
then
rm -r -f -v "$TMPFILE_PATH"
fi Shell Script V2has a hacky workaround that adds appropriate icons to already existing desktop files that feature the steam fallback icon on both the desktop folder and the user application folder under #!/usr/bin/env bash
shopt -s nullglob
OVERWRITE_EXISTING_ICONS="false"
STEAM_ASSET_PATH="$HOME/.local/share/Steam/appcache/librarycache/"
TMPFILE_PATH="/tmp/IMAGES_TO_MODIFY/"
if ! command -v basename >/dev/null 2>&1
then
UTIL_EXISTS="0"
fi
if ! command -v identify >/dev/null 2>&1
then
UTIL_EXISTS="0"
fi
if ! command -v mogrify >/dev/null 2>&1
then
UTIL_EXISTS="0"
fi
if [ "$UTIL_EXISTS" == "0" ]
then
if exists apt
then
PACKAGE_MANAGER="apt"
elif exists dnf
then
PACKAGE_MANAGER="dnf"
elif exists yum
then
PACKAGE_MANAGER="yum"
elif exists pacman
then
PACKAGE_MANAGER="pacman"
fi
echo "WARNING: Missing 'imagemagick' and/or 'coreutils', attempting to detect system package manager and then install the missing packages..."
case "$PACKAGE_MANAGER" in
"apt")
echo "Detected apt..."
sudo apt update
sudo apt install coreutils imagemagick
;;
"dnf")
echo "Detected dnf..."
sudo dnf upgrade
sudo dnf install coreutils ImageMagick
;;
"yum")
echo "Detected yum..."
sudo yum update
sudo yum install coreutils ImageMagick
;;
"pacman")
echo "Detected pacman..."
sudo pacman -Syu
sudo pacman -Sy imagemagick coreutils
;;
*)
echo "ERROR: Unable to detect package manager..."
echo "please find and install 'basename', possibly a part of 'coreutils' and, 'identify' and 'mogrify', possibly a part of 'imagemagick', according to your distributions instructions"
exit 1
;;
esac
if ! command -v basename >/dev/null 2>&1
then
echo "ERROR: Still missing 'basename' and/or 'coreutils', please find the package containing it and use your system package manager to install the missing package..."
exit 1
fi
if ! command -v identify >/dev/null 2>&1
then
echo "ERROR: Still missing 'identify' and/or 'imagemagick', please find the package containing it and use your system package manager to install the missing package..."
exit 1
fi
if ! command -v mogrify >/dev/null 2>&1
then
echo "ERROR: Still missing 'mogrify' and/or 'imagemagick', please find the package containing it and use your system package manager to install the missing package..."
exit 1
fi
fi
mkdir -p -v "$TMPFILE_PATH"
FILES=$(find "$STEAM_ASSET_PATH" -name "*_icon.*")
for F in $FILES
do
IMG_FORMAT="$(file -i -b "$F" | sed -e 's/;.*//')"
IMG_FORMAT="${IMG_FORMAT//image\/}"
BASENAME_NO_EXT="$(basename "${F%.*}")"
case "$IMG_FORMAT" in
"png")
echo "$(basename "$F") is already in .png format, moving it to ${TMPFILE_PATH}$(basename "$F") and then renaming it to .png"
cp -v -T "$F" "${TMPFILE_PATH}${BASENAME_NO_EXT}.png"
;;
"jpeg")
echo "$(basename "$F") is not in .png format, moving it to ${TMPFILE_PATH}$(basename "$F") and then converting to .png"
cp -v -T "$F" "${TMPFILE_PATH}${BASENAME_NO_EXT}.jpg"
mogrify -quiet -auto-orient -format png "${TMPFILE_PATH}${BASENAME_NO_EXT}.jpg"
rm -v "${TMPFILE_PATH}${BASENAME_NO_EXT}.jpg"
;;
"vnd.microsoft.icon")
echo "$(basename "$F") is not in .png format, moving it to ${TMPFILE_PATH}$(basename "$F") and then converting to .png"
cp -v -T "$F" "${TMPFILE_PATH}${BASENAME_NO_EXT}.ico"
mogrify -quiet -auto-orient -format png "${TMPFILE_PATH}${BASENAME_NO_EXT}.ico"
rm -v "${TMPFILE_PATH}${BASENAME_NO_EXT}.ico"
;;
"x-tga")
echo "$(basename "$F") is not in .png format, moving it to ${TMPFILE_PATH}$(basename "$F") and then converting to .png"
cp -v -T "$F" "${TMPFILE_PATH}${BASENAME_NO_EXT}.tga"
mogrify -quiet -auto-orient -format png "${TMPFILE_PATH}${BASENAME_NO_EXT}.tga"
rm -v "${TMPFILE_PATH}${BASENAME_NO_EXT}.tga"
;;
*)
echo "$F has unknown image format $IMG_FORMAT"
;;
esac
done
PNG_FILES=$(find "$TMPFILE_PATH" -name "*.png")
for P in $PNG_FILES
do
IMG_WIDTH="$(identify -format '%w' "$P")"
IMG_HEIGHT="$(identify -format '%h' "$P")"
NO_DIGIT_FILENAME="$(basename "$P" | sed "s/-[[:digit:]]\+//")"
NO_ICON_FILENAME="${NO_DIGIT_FILENAME//_icon/}"
FULL_NEW_FILENAME="steam_icon_$NO_ICON_FILENAME"
NEW_PATHNAME="$HOME/.local/share/icons/hicolor/${IMG_WIDTH}x${IMG_HEIGHT}/apps/"
FINAL_FILENAME="${NEW_PATHNAME}${FULL_NEW_FILENAME}"
echo "$(basename "$P") is ${IMG_WIDTH}x${IMG_HEIGHT}"
if ! [ -e "$NEW_PATHNAME" ]
then
mkdir -p -v "$NEW_PATHNAME"
fi
echo "Moving $(basename "$P") to $NEW_PATHNAME"
if [ "${OVERWRITE_EXISTING_ICONS,,}" == "false" ] || [ "${OVERWRITE_EXISTING_ICONS,,}" == "no" ] || [ "$OVERWRITE_EXISTING_ICONS" == "0" ]
then
mv -v -n "$P" "$FINAL_FILENAME"
if [ -e "$FINAL_FILENAME" ]
then
echo "$FINAL_FILENAME already exists, skipping..."
rm -v "$FINAL_FILENAME"
fi
elif [ "${OVERWRITE_EXISTING_ICONS,,}" != "false" ] && [ "${OVERWRITE_EXISTING_ICONS,,}" != "no" ] && [ "$OVERWRITE_EXISTING_ICONS" != "0" ]
then
if [ -e "$FINAL_FILENAME" ]
then
echo "$FINAL_FILENAME already exists, overwriting..."
elif ! [ -e "$FINAL_FILENAME" ]
then
echo "$FINAL_FILENAME doesnt exist, continuing..."
fi
mv -v -f "$P" "$FINAL_FILENAME"
fi
done
rmdir -v "$TMPFILE_PATH"
if [ -e "$TMPFILE_PATH" ]
then
rm -r -f -v "$TMPFILE_PATH"
fi
OIFS="$IFS"
IFS=$'\n'
fix_icons() {
if [ ! -h "$1" ]; then
NEW_VALUE='steam://rungameid/'
for NEXT in `cat "$1"`
do
if [[ "$NEXT" == *"$NEW_VALUE"* ]]; then
GAME_ID="$(echo "$NEXT" | sed 's,^Exec[[:space:]]*=[[:space:]]*steam[[:space:]]*steam://rungameid/,,i')"
NO_SPACE_GAME_ID="${GAME_ID//_icon/}"
NO_TAB_GAME_ID="${NO_SPACE_GAME_ID// /}"
echo "$1 is a shortcut to appid $NO_TAB_GAME_ID"
sed -i "s/^Icon[[:space:]]*=[[:space:]]*steam$/Icon=steam_icon_${NO_TAB_GAME_ID}/i" "$1"
fi
done
fi
}
DESKTOP_ENTRIES=$(find "$HOME/Desktop" -name "*.desktop")
for D in $DESKTOP_ENTRIES
do
fix_icons "$D"
done
APPLICATION_ENTRIES=$(find "$HOME/.local/share/applications/" -name "*.desktop")
for A in $APPLICATION_ENTRIES
do
fix_icons "$A"
done
IFS="$OIFS" Shell Script V3 --WILL REMOVE ON REQUEST--has all of the stuff from v2, as well as a help feature, a feature to download icons for steam games found as desktop shortcuts in #!/usr/bin/env bash
shopt -s nullglob
STEAM_ASSET_PATH="$HOME/.local/share/Steam/appcache/librarycache/"
TMPFILE_PATH="/tmp/IMAGES_TO_MODIFY/"
DESKTOP_FILE_LOCATION="$HOME/Desktop/"
APPLICATION_FILE_LOCATION="$HOME/.local/share/applications/"
ICON_PATH="$HOME/.local/share/icons/"
HELP_ARGUMENT="help"
OVERWRITE_ARGUEMENT="overwrite"
DOWNLOAD_ARGUMENT="download"
OIFS="$IFS"
IFS=$'\n'
FIX_INVALID_NAME='.*].*$'
NO_MATCH_GAME_ID='^Icon[[:space:]]*=[[:space:]]*steam$'
if [ "${1,,}" == "help" ] || [ "${2,,}" == "help" ] || [ "${3,,}" == "help" ]
then
echo "other than $HELP_ARGUMENT, this script accepts up to two other arguments simultaneously, notably $DOWNLOAD_ARGUMENT, and $OVERWRITE_ARGUEMENT"
echo "however, $HELP_ARGUMENT will always print this message, and then exit without performing any other tasks"
echo "$DOWNLOAD_ARGUMENT when set, will download and then process icons for steam games found as .desktop files on either $DESKTOP_FILE_LOCATION or $APPLICATION_FILE_LOCATION"
echo "$DOWNLOAD_ARGUMENT when not set, will skip downloading icons, but those already found in $STEAM_ASSET_PATH will still be copied and then processed"
echo "$OVERWRITE_ARGUEMENT when set, while processing icon files found in $STEAM_ASSET_PATH will then overwrite any icons of the same name that already exist in $ICON_PATH"
echo "$OVERWRITE_ARGUEMENT when not set, will still process icons normally, but any icons with the same name as one that exists in $ICON_PATH will be ingored"
exit 0
fi
read_ids() {
if [ ! -h "$1" ] && ! [[ $1 =~ $FIX_INVALID_NAME ]]
then
while IFS= read -r line
do
if [[ "$line" =~ ^Exec[[:space:]]*=[[:space:]]*steam[[:space:]]*steam\:\/\/rungameid\/[0-9][0-9]*[[:space:]]*$ ]] && [[ "$line" =~ ^Exec[[:space:]]*=[[:space:]]*steam ]]
then
GAME_ID="$(echo "$line" | sed 's,^Exec[[:space:]]*=[[:space:]]*steam[[:space:]]*steam\:\/\/rungameid\/,,i')"
export GAME_ID
if [[ $GAME_ID =~ ^[0-9][0-9]*[[:space:]]* ]]
then
NO_SPACE_GAME_ID="$(echo "$GAME_ID" | sed 's/[[:space:]]*//i')"
export NO_SPACE_GAME_ID
fi
fi
done < "$1"
fi
}
download_icons() {
if [ -n "${NO_SPACE_GAME_ID}" ] && [[ "$NO_SPACE_GAME_ID" =~ ^[0-9][0-9]*$ ]] && ! [[ "$NO_SPACE_GAME_ID" =~ ^[[:space:]][[:space:]]*$ ]]
then
echo "Downloading icon for $NO_SPACE_GAME_ID"
SGDBoop "sgdb://boop/steam/${NO_SPACE_GAME_ID}-clienticon-en"
fi
unset GAME_ID
unset NO_SPACE_GAME_ID
}
set_icons() {
if [ -n "${NO_SPACE_GAME_ID}" ] && [[ "$NO_SPACE_GAME_ID" =~ ^[0-9][0-9]*$ ]] && ! [[ "$NO_SPACE_GAME_ID" =~ ^[[:space:]][[:space:]]*$ ]]
then
if [[ "$1" =~ $NO_MATCH_GAME_ID ]]
then
echo "$1 has default icon, changing it to the one for $NO_SPACE_GAME_ID"
sed -i "s/^Icon[[:space:]]*=[[:space:]]*steam$/Icon=steam_icon_${NO_SPACE_GAME_ID}/i" "$1"
else
echo "$1 already has the icon for $NO_SPACE_GAME_ID, skipping"
fi
fi
unset GAME_ID
unset NO_SPACE_GAME_ID
}
DESKTOP_ENTRIES=$(find "$DESKTOP_FILE_LOCATION" -name "*.desktop")
APPLICATION_ENTRIES=$(find "$APPLICATION_FILE_LOCATION" -name "*.desktop")]
STEAM_ASSETS=$(find "$STEAM_ASSET_PATH" -name "*_icon.*")
if [ "${1,,}" == "download" ] || [ "${2,,}" == "download" ]
then
for D in $DESKTOP_ENTRIES
do
read_ids "$D"
download_icons "$D"
done
for A in $APPLICATION_ENTRIES
do
read_ids "$A"
download_icons "$A"
done
elif ! [ "${1,,}" == "download" ] && ! [ "${2,,}" == "download" ]
then
echo "download flag not set, skipping donwload of icons..."
elif [ "${1,,}" == "download" ] && [ "${2,,}" == "download" ]
then
if ! command -v SGDBoop >/dev/null 2>&1
then
echo "ERROR: download flag set but 'SGDBoop' is missing, please disable the download flag or follow the instructions to install it at https://www.steamgriddb.com/boop"
exit 1
fi
fi
echo "SGDBoop is missing"
if ! command -v basename >/dev/null 2>&1
then
UTIL_EXISTS="0"
fi
if ! command -v identify >/dev/null 2>&1
then
UTIL_EXISTS="0"
fi
if ! command -v mogrify >/dev/null 2>&1
then
UTIL_EXISTS="0"
fi
if [ "$UTIL_EXISTS" == "0" ]
then
if exists apt
then
PACKAGE_MANAGER="apt"
elif exists dnf
then
PACKAGE_MANAGER="dnf"
elif exists yum
then
PACKAGE_MANAGER="yum"
elif exists pacman
then
PACKAGE_MANAGER="pacman"
fi
echo "WARNING: Missing 'imagemagick' and/or 'coreutils', attempting to detect system package manager and then install the missing packages..."
case "$PACKAGE_MANAGER" in
"apt")
echo "Detected apt..."
sudo apt update
sudo apt install coreutils imagemagick
;;
"dnf")
echo "Detected dnf..."
sudo dnf upgrade
sudo dnf install coreutils ImageMagick
;;
"yum")
echo "Detected yum..."
sudo yum update
sudo yum install coreutils ImageMagick
;;
"pacman")
echo "Detected pacman..."
sudo pacman -Syu
sudo pacman -Sy imagemagick coreutils
;;
*)
echo "ERROR: Unable to detect package manager..."
echo "please find and install 'basename', possibly a part of 'coreutils' and, 'identify' and 'mogrify', possibly a part of 'imagemagick', according to your distributions instructions"
exit 1
;;
esac
if ! command -v basename >/dev/null 2>&1
then
echo "ERROR: Still missing 'basename' and/or 'coreutils', please find the package containing it and use your system package manager to install the missing package..."
exit 1
fi
if ! command -v identify >/dev/null 2>&1
then
echo "ERROR: Still missing 'identify' and/or 'imagemagick', please find the package containing it and use your system package manager to install the missing package..."
exit 1
fi
if ! command -v mogrify >/dev/null 2>&1
then
echo "ERROR: Still missing 'mogrify' and/or 'imagemagick', please find the package containing it and use your system package manager to install the missing package..."
exit 1
fi
fi
mkdir -p "$TMPFILE_PATH"
for S in $STEAM_ASSETS
do
IMG_FORMAT="$(file -i -b "$S" | sed -e 's/;.*//')"
IMG_FORMAT="${IMG_FORMAT//image\//}"
BASENAME_NO_EXT="$(basename "${S%.*}")"
case "$IMG_FORMAT" in
"png")
echo "$S is already a .png, moving to ${TMPFILE_PATH} and renaming to ${BASENAME_NO_EXT}.png"
cp -v -T "$S" "${TMPFILE_PATH}${BASENAME_NO_EXT}.png"
;;
"jpeg")
echo "$S is a .jpg, not a .png, moving to ${TMPFILE_PATH} and converting to ${BASENAME_NO_EXT}.png"
cp -v -T "$S" "${TMPFILE_PATH}${BASENAME_NO_EXT}.jpg"
mogrify -quiet -auto-orient -format png "${TMPFILE_PATH}${BASENAME_NO_EXT}.jpg"
rm -v "${TMPFILE_PATH}${BASENAME_NO_EXT}.jpg"
;;
"x-tga")
echo "$S is a .tga, not a .png, moving to ${TMPFILE_PATH} and converting to ${BASENAME_NO_EXT}.png"
cp -v -T "$S" "${TMPFILE_PATH}${BASENAME_NO_EXT}.tga"
mogrify -quiet -auto-orient -format png "${TMPFILE_PATH}${BASENAME_NO_EXT}.tga"
rm -v "${TMPFILE_PATH}${BASENAME_NO_EXT}.tga"
;;
"vnd.microsoft.icon")
echo "$S is a .ico, not a .png, moving to ${TMPFILE_PATH} and converting to ${BASENAME_NO_EXT}.png"
cp -v -T "$S" "${TMPFILE_PATH}${BASENAME_NO_EXT}.ico"
mogrify -quiet -auto-orient -format png "${TMPFILE_PATH}${BASENAME_NO_EXT}.ico"
rm -v "${TMPFILE_PATH}${BASENAME_NO_EXT}.ico"
;;
*)
echo "$S has unknown image format $IMG_FORMAT"
;;
esac
done
PNG_FILES=$(find "$TMPFILE_PATH" -name "*.png")
for P in $PNG_FILES
do
IMG_WIDTH="$(identify -format '%w' "$P")"
IMG_HEIGHT="$(identify -format '%h' "$P")"
NO_DIGIT_FILENAME="$(basename "$P" | sed "s/-[[:digit:]]\+//")"
NO_ICON_FILENAME="${NO_DIGIT_FILENAME//_icon/}"
FULL_NEW_FILENAME="steam_icon_$NO_ICON_FILENAME"
NEW_PATHNAME="${ICON_PATH}hicolor/${IMG_WIDTH}x${IMG_HEIGHT}/apps/"
FINAL_FILENAME="${NEW_PATHNAME}${FULL_NEW_FILENAME}"
echo "image is ${IMG_WIDTH}x${IMG_HEIGHT}"
if ! [ -e "$NEW_PATHNAME" ]
then
mkdir -v -p "$NEW_PATHNAME"
fi
if [ "${1,,}" == "overwrite" ] || [ "${2,,}" == "overwrite" ]
then
if [ -e "$FINAL_FILENAME" ]
then
echo "$FINAL_FILENAME exists, and overwrite flag is set... moving and overwriting..."
elif ! [ -e "$FINAL_FILENAME" ]
then
echo "$FINAL_FILENAME does not exist... moving..."
fi
mv -v -f "$P" "$FINAL_FILENAME"
else
if [ -e "$FINAL_FILENAME" ]
then
echo "$FINAL_FILENAME exists, and overwrite flag is not set... ignoring..."
rm -v "$FINAL_FILENAME"
elif ! [ -e "$FINAL_FILENAME" ]
then
echo "$FINAL_FILENAME does not exist... moving..."
mv -v -n "$P" "$FINAL_FILENAME"
fi
fi
done
rmdir "$TMPFILE_PATH"
if [ -e "$TMPFILE_PATH" ]
then
rm -v -r -f "$TMPFILE_PATH"
fi
DESKTOP_ENTRIES_2=$(find "$DESKTOP_FILE_LOCATION" -name "*.desktop")
for D2 in $DESKTOP_ENTRIES_2
do
read_ids "$D2"
set_icons "$D2"
done
APPLICATION_ENTRIES_2=$(find "$APPLICATION_FILE_LOCATION" -name "*.desktop")]
for A2 in $APPLICATION_ENTRIES_2
do
read_ids "$A2"
set_icons "$A2"
done
IFS="$OIFS" |
SGDBoop doesn't add any icon to
.local/share/icons/hicolor
meaning even if I apply an icon it would still show the steam default one in the desktop or application menus. Regardless if I apply the sgd icon before I install the game or after.**I think this feature would be be so helpful and thank you for this app!
System: arch, steam runtime (not flatpak), sdgboop: flatpak
The text was updated successfully, but these errors were encountered: