Subversion Repositories My Stuff

Rev

Rev 6 | Go to most recent revision | View as "text/plain" | Blame | Compare with Previous | Last modification | View Log | RSS feed

#!/bin/sh

#####################################################################
# Script to replace the standard KDE 4 start icon with Gentoo Logo
# The logo can be downloaded here:
# http://gentoo-art.org/CONTENT/content-files/117383-gentoo-start-icon.svg
# This script is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# Author: Andrzej Kardaƛ
# License: GPLv3
# The full version of the licencse can be obtainted by visiting:
# http://www.gnu.org/licenses/gpl.html
#######################################################################

ICON=gentoo-start-icon.svg
RESOLUTION=(16x16 22x22 32x32 48x48 64x64 128x128 256x256)
URL="http://gentoo-art.org/CONTENT/content-files/117383-gentoo-start-icon.svg"
WGET=/usr/bin/wget
MV=/bin/mv
CP=/bin/cp
RM=/bin/rm

if [ "${1}" = "global" ]; then
        PATH="/usr/share/icons/"       
elif [ "${1}" = "local" ]; then
        PATH=`echo ~/.kde4/share/icons/`
else
        echo
        echo "Usage ./kde-icon.sh local | global [theme_name]"
        echo "For example ./kde-icon.sh local OxygenRefit2-black-version"
        echo
        exit 1
fi

if [ "${#}" -eq 1 ]; then
        echo "You didn't provide a theme_name I'm assuming we are changing the oxygen default icon theme"
        echo
        THEME="oxygen"
else
   THEME=${2}
fi

echo "Checking if full theme path: ${PATH}${THEME} exists"
echo
if [ -d ${PATH}${THEME} ]; then
        echo "Path seems ok"
        echo
else
        echo "Can not find the provided path check script parameters"
        echo
        exit 1
fi

echo "Checking if you have write access to theme path"
echo
if [ -w ${PATH}${THEME} ]; then
        echo "Your rights seems ok"
        echo
else
        echo "You do not have write access to the theme path you will not be able to change the icons"
        echo "Maybe you should run the script as root"
        echo
        exit 1
fi

echo "Downloading the logo icon"
echo
${WGET} --output-document=${ICON} ${URL} || die "downloading of the icon failed"

echo "Making backup of existing icons"
echo
for i in  "${RESOLUTION[@]}";
do
        echo procesing ${PATH}${THEME}/$i/places/start-here-kde.png
        ${MV} ${PATH}${THEME}/$i/places/start-here-kde.png ${PATH}/${THEME}/$i/places/start-here-kde.png.bak
done

echo "Placing new Icon"
echo
for i in  "${RESOLUTION[@]}";
do
        echo procesing ${PATH}${THEME}/$i/places/start-here-kde.svg
        ${CP} ${ICON} ${PATH}${THEME}/$i/places/start-here-kde.svg
done
echo "I'm Removing the downloaded icon"
${RM} -f ${ICON}
echo
echo "That's all!"
echo "To see the changes you need to change the icon set using KDE system settings"
echo