Subversion Repositories My Stuff

Rev

Rev 6 | Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
5 kardasa 1
#!/bin/sh
2
 
3
#####################################################################
4
# Script to replace the standard KDE 4 start icon with Gentoo Logo 
5
# The logo can be downloaded here:
6
# http://gentoo-art.org/CONTENT/content-files/117383-gentoo-start-icon.svg
7
# This script is distributed in the hope that it will be useful,
8
# but WITHOUT ANY WARRANTY; without even the implied warranty of
9
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10
# GNU General Public License for more details.
11
# Author: Andrzej Kardaƛ
12
# License: GPLv3 
13
# The full version of the licencse can be obtainted by visiting: 
14
# http://www.gnu.org/licenses/gpl.html
15
#######################################################################
16
 
17
ICON=gentoo-start-icon.svg
18
RESOLUTION=(16x16 22x22 32x32 48x48 64x64 128x128 256x256)
19
URL="http://gentoo-art.org/CONTENT/content-files/117383-gentoo-start-icon.svg"
20
WGET=/usr/bin/wget
21
MV=/bin/mv
22
CP=/bin/cp
23
RM=/bin/rm
24
 
25
if [ "${1}" = "global" ]; then
26
        PATH="/usr/share/icons/"       
27
elif [ "${1}" = "local" ]; then
28
        PATH=`echo ~/.kde4/share/icons/`
29
else
30
        echo
31
        echo "Usage ./kde-icon.sh local | global [theme_name]"
32
        echo "For example ./kde-icon.sh local OxygenRefit2-black-version"
33
        echo
34
        exit 1
35
fi
36
 
37
if [ "${#}" -eq 1 ]; then
38
        echo "You didn't provide a theme_name I'm assuming we are changing the oxygen default icon theme"
39
        echo
40
        THEME="oxygen"
41
else
42
   THEME=${2}
43
fi
44
 
45
echo "Checking if full theme path: ${PATH}${THEME} exists"
46
echo
47
if [ -d ${PATH}${THEME} ]; then
48
        echo "Path seems ok"
49
        echo
50
else
51
        echo "Can not find the provided path check script parameters"
52
        echo
53
        exit 1
54
fi
55
 
56
echo "Checking if you have write access to theme path"
57
echo
58
if [ -w ${PATH}${THEME} ]; then
59
        echo "Your rights seems ok"
60
        echo
61
else
62
        echo "You do not have write access to the theme path you will not be able to change the icons"
63
        echo "Maybe you should run the script as root"
64
        echo
65
        exit 1
66
fi
67
 
68
echo "Downloading the logo icon"
69
echo
70
${WGET} --output-document=${ICON} ${URL} || die "downloading of the icon failed"
71
 
72
echo "Making backup of existing icons"
73
echo
74
for i in  "${RESOLUTION[@]}";
75
do
76
        echo procesing ${PATH}${THEME}/$i/places/start-here-kde.png
77
        ${MV} ${PATH}${THEME}/$i/places/start-here-kde.png ${PATH}/${THEME}/$i/places/start-here-kde.png.bak
78
done
79
 
80
echo "Placing new Icon"
81
echo
82
for i in  "${RESOLUTION[@]}";
83
do
84
        echo procesing ${PATH}${THEME}/$i/places/start-here-kde.svg
85
        ${CP} ${ICON} ${PATH}${THEME}/$i/places/start-here-kde.svg
86
done
87
echo "I'm Removing the downloaded icon"
88
${RM} -f ${ICON}
89
echo
90
echo "That's all!"
91
echo "To see the changes you need to change the icon set using KDE system settings"
92
echo