Rev 7 | Details | Compare with Previous | 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" |
||
8 | kardasa | 20 | WGET="/usr/bin/wget" |
21 | MV="/bin/mv" |
||
22 | CP="/bin/cp" |
||
23 | RM="/bin/rm" |
||
5 | kardasa | 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 |
||
6 | kardasa | 31 | echo "Usage ./kde-icon.sh local | global [theme_name] [restore]" |
5 | kardasa | 32 | echo |
6 | kardasa | 33 | echo "Examples:" |
34 | echo "If you want to change the icons just run:" |
||
35 | echo "./kde-icon.sh local OxygenRefit2-black-version" |
||
36 | echo |
||
37 | echo "If you want to restore old icons run:" |
||
38 | echo "./kde-icon.sh local OxygenRefit2-black-version restore" |
||
39 | echo |
||
5 | kardasa | 40 | exit 1 |
41 | fi |
||
42 | |||
43 | if [ "${#}" -eq 1 ]; then |
||
44 | echo "You didn't provide a theme_name I'm assuming we are changing the oxygen default icon theme" |
||
45 | echo |
||
46 | THEME="oxygen" |
||
47 | else |
||
48 | THEME=${2} |
||
49 | fi |
||
50 | |||
51 | echo "Checking if full theme path: ${PATH}${THEME} exists" |
||
52 | echo |
||
53 | if [ -d ${PATH}${THEME} ]; then |
||
54 | echo "Path seems ok" |
||
55 | echo |
||
56 | else |
||
57 | echo "Can not find the provided path check script parameters" |
||
58 | echo |
||
59 | exit 1 |
||
60 | fi |
||
61 | |||
62 | echo "Checking if you have write access to theme path" |
||
63 | echo |
||
64 | if [ -w ${PATH}${THEME} ]; then |
||
65 | echo "Your rights seems ok" |
||
66 | echo |
||
67 | else |
||
6 | kardasa | 68 | echo "You do not have write access to the theme path you will not be able to change the icons" |
5 | kardasa | 69 | echo "Maybe you should run the script as root" |
70 | echo |
||
71 | exit 1 |
||
72 | fi |
||
73 | |||
6 | kardasa | 74 | if [ "${3}" == "restore" ] ; then |
75 | echo "You requested restoration of previously stored icons" |
||
76 | echo |
||
77 | echo "Checking if stored copies of old icons are available and performing restore if possible" |
||
78 | for i in "${RESOLUTION[@]}"; |
||
79 | do |
||
80 | echo processing ${PATH}${THEME}/$i/places/start-here-kde.png |
||
81 | if [ -w ${PATH}${THEME}/$i/places/start-here-kde.png.bak ]; then |
||
82 | if [ -w ${PATH}${THEME}/$i/places/start-here-kde.svg ]; then |
||
83 | echo "Removing svg icon: ${PATH}${THEME}/$i/places/start-here-kde.svg" |
||
84 | ${RM} ${PATH}${THEME}/$i/places/start-here-kde.svg |
||
85 | echo |
||
86 | fi |
||
87 | echo "Restoring old icons" |
||
88 | ${MV} -f ${PATH}${THEME}/$i/places/start-here-kde.png.bak ${PATH}/${THEME}/$i/places/start-here-kde.png |
||
89 | echo |
||
90 | else |
||
91 | echo "Can't find ${PATH}${THEME}/$i/places/start-here-kde.png.bak or you do not have write access to file" |
||
92 | echo |
||
93 | fi |
||
94 | done |
||
95 | echo "Finished" |
||
96 | echo "To see the changes you need to change the icon set using KDE system settings" |
||
97 | echo |
||
98 | else |
||
99 | echo "Downloading the logo icon" |
||
100 | echo |
||
101 | ${WGET} --output-document=${ICON} ${URL} || die "downloading of the icon failed" |
||
5 | kardasa | 102 | |
6 | kardasa | 103 | echo "Making backup of existing icons" |
104 | echo |
||
105 | for i in "${RESOLUTION[@]}"; |
||
106 | do |
||
107 | echo processing ${PATH}${THEME}/$i/places/start-here-kde.png |
||
108 | if [ -w ${PATH}${THEME}/$i/places/start-here-kde.png ]; then |
||
109 | if (${MV} -f ${PATH}${THEME}/$i/places/start-here-kde.png ${PATH}/${THEME}/$i/places/start-here-kde.png.bak) then |
||
110 | echo "Storing ${PATH}${THEME}/$i/places/start-here-kde.png as ${PATH}/${THEME}/$i/places/start-here-kde.png.bak succsesfull" |
||
111 | echo |
||
112 | else |
||
113 | echo "There was error while storing icon ${PATH}${THEME}/$i/places/start-here-kde.png" |
||
114 | fi |
||
115 | else |
||
116 | echo "Icon ${PATH}${THEME}/$i/places/start-here-kde.png dosn't exist or you don't have the write access to it!" |
||
117 | echo "I have nothing to do here" |
||
118 | echo |
||
119 | fi |
||
120 | done |
||
5 | kardasa | 121 | |
6 | kardasa | 122 | echo |
123 | echo "Placing new Icon" |
||
124 | echo |
||
125 | for i in "${RESOLUTION[@]}"; |
||
126 | do |
||
127 | echo processing ${PATH}${THEME}/$i/places/start-here-kde.svg |
||
128 | if (${CP} ${ICON} ${PATH}${THEME}/$i/places/start-here-kde.svg) then |
||
129 | echo "Placing icon ${PATH}${THEME}/$i/places/start-here-kde.svg succsesfull" |
||
130 | echo |
||
131 | else |
||
132 | echo "There was error while placing icon ${PATH}${THEME}/$i/places/start-here-kde.svg" |
||
133 | echo |
||
134 | fi |
||
135 | done |
||
136 | echo "I'm Removing the downloaded icon" |
||
137 | ${RM} -f ${ICON} |
||
138 | echo |
||
139 | echo "That's all!" |
||
140 | echo "To see the changes you need to change the icon set using KDE system settings" |
||
141 | echo |
||
142 | fi |