#!/bin/bash fixname () { echo -e "\e[93mTrying to fix icon: \e[39m$3" if [ -e "$1" ]; then FILE=$(find $1/$2.*) if [ -e "$FILE" ] then filename=$(basename "$FILE") extension="${filename##*.}" filename="${filename%.*}" if [ ! -e "$1/$3.$extension" ]; then echo "" echo -e "\e[93mpath : \e[39m$1" echo -e "\e[93mfilename : \e[39m$filename" echo -e "\e[93mextension : \e[39m$extension" echo " " echo -e "\e[93mlinking to : \e[39m$3.$extension" echo " " sudo ln -s $FILE $1/$3.$extension echo -e "\e[92mSuccessfully fixed icon for \e[39m$3" echo "----" else echo -e "\e[92mIcon allready fixed!!!\e[39m" echo "----" fi else echo " " echo -e "\e[91mNo icon found for: \e[39m$3" echo -e "\e[93mWill try the parent themes (if any)...\e[39m" echo " " fi else echo " " echo -e "\e[91mThis theme does not have App-icons\e[39m" echo -e "\e[93mWill try the parent themes (if any)...\e[39m" echo " " fi } fixfolder () { echo "----" echo -e "\e[92mTrying to fix the theme:\e[39m $2" echo " " grep -Pzo "\[.*\][^ ]Context=Applications" $1 | grep -Pzo "\[.*\]" > ~/.temp-icon-list sed -i 's/\x0//g' ~/.temp-icon-list LIST=$(cat ~/.temp-icon-list) rm ~/.temp-icon-list for p in $LIST do FOLDERS=$(echo $p | perl -pe 's/\[(.*)\]/$1/g') ICONPATH="/usr/share/icons/${2}/${FOLDERS}" fixname $ICONPATH gnome-photos org.gnome.Photos fixname $ICONPATH gnome-books org.gnome.Books fixname $ICONPATH cheese org.gnome.Cheese fixname $ICONPATH gnome-documents org.gnome.Documents fixname $ICONPATH nautilus org.gnome.Nautilus fixname $ICONPATH gnome-calendar org.gnome.Calendar fixname $ICONPATH addressbook org.gnome.Contacts fixname $ICONPATH gnome-maps org.gnome.Maps fixname $ICONPATH org.gnome.Weather.Application org.gnome.Weather fixname $ICONPATH totem org.gnome.Totem fixname $ICONPATH builder org.gnome.Builder fixname $ICONPATH gnome-clocks org.gnome.clocks fixname $ICONPATH polari org.gnome.Polari fixname $ICONPATH gnome-software org.gnome.Software fixname $ICONPATH task org.gnome.Todo sudo gtk-update-icon-cache -f "/usr/share/icons/${2}/" done } # Display a notification with an icon THEME=$(gsettings get org.gnome.desktop.interface icon-theme | tr -d "'") INDEX="/usr/share/icons/${THEME}/index.theme" fixfolder $INDEX $THEME INHERITS=$(cat "$INDEX" | grep "Inherits=") if [[ ! -z $INHERITS ]]; then echo "----" echo -e "\e[92mTrying the parent themes...\e[39m" echo " " THEMELIST=$( echo $INHERITS | perl -pe 's/Inherits=//g' | perl -pe 's/,/\n/g' ) for t in $THEMELIST do case "$t" in Adwaita) break ;; *) INDEX="/usr/share/icons/${t}/index.theme" if [ -e "$INDEX" ] then fixfolder $INDEX $t else echo -e " " echo -e "\e[91mMissing icon-theme: \e[39m$t" echo -e "\e[93mYou should really install it " echo -e "beacuse your theme inherits icons from it!\e[39m" echo -e " " fi ;; esac done fi