-
Notifications
You must be signed in to change notification settings - Fork 43
/
Copy pathinstall.sh
executable file
·283 lines (248 loc) · 10.3 KB
/
install.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
#!/usr/bin/env bash
ROOT_UID=0
DEST_DIR=
# Destination directory
if [ "$UID" -eq "$ROOT_UID" ]; then
DEST_DIR="/usr/share/icons"
else
DEST_DIR="$HOME/.local/share/icons"
fi
SRC_DIR=$(cd $(dirname $0) && pwd)
THEME_NAME=McMojave-circle
THEME_VARIANTS=('' '-red' '-pink' '-purple' '-blue' '-green' '-yellow' '-orange' '-brown' '-grey' '-black')
COLOR_VARIANTS=('' '-light' '-dark')
usage() {
cat << EOF
Usage: $0 [OPTION]
OPTIONS:
-a, --all Install all color folder versions
-d, --dest Specify theme destination directory (Default: $HOME/.local/share/icons)
-n, --name Specify theme name (Default: ${THEME_NAME})
-c, --circle Specify circle folder version
-t, --theme VARIANT Specify theme color variant(s) [default|red|pink|purple|blue|green|yellow|orange|brown|grey|black|all] (Default: light blue)
-h, --help Show this help
EOF
}
install() {
local dest=${1}
local name=${2}
local theme=${3}
local color=${4}
local THEME_DIR=${dest}/${name}${theme}${color}
[[ -d ${THEME_DIR} ]] && rm -rf ${THEME_DIR}
echo "Installing '${THEME_DIR}'..."
mkdir -p ${THEME_DIR}
cp -r ${SRC_DIR}/{COPYING,AUTHORS} ${THEME_DIR}
cp -r ${SRC_DIR}/src/index.theme ${THEME_DIR}
# if [[ $DESKTOP_SESSION == '/usr/share/xsessions/plasma' && ${color} == '' ]]; then
# sed -i "s/hicolor/breeze,hicolor/g" ${THEME_DIR}/index.theme
# fi
# if [[ $DESKTOP_SESSION == '/usr/share/xsessions/plasma' && ${color} == '-dark' ]]; then
# sed -i "s/hicolor/breeze-dark,hicolor/g" ${THEME_DIR}/index.theme
# fi
cd ${THEME_DIR}
sed -i "s/${name}/${name}${theme}${color}/g" index.theme
if [[ ${color} == '' ]]; then
mkdir -p ${THEME_DIR}/status
cp -r ${SRC_DIR}/src/{actions,animations,apps,categories,devices,emotes,emblems,mimes,places} ${THEME_DIR}
cp -r ${SRC_DIR}/src/status/{16,22,24,32,symbolic} ${THEME_DIR}/status
cp -r ${SRC_DIR}/links/{actions,apps,categories,devices,emotes,emblems,mimes,places,status} ${THEME_DIR}
fi
if [[ ${color} == '' && ${theme} != '' ]]; then
cp -r ${SRC_DIR}/colorful-folder/folder${theme}/*.svg ${THEME_DIR}/places/scalable
fi
if [[ ${circle} == 'true' && ${theme} == '' && ${color} == '' ]]; then
cp -r ${SRC_DIR}/circle-folder/*.svg ${THEME_DIR}/places/scalable
fi
if [[ ${color} == '' && $DESKTOP_SESSION == '/usr/share/xsessions/budgie-desktop' ]]; then
cp -r ${SRC_DIR}/src/status/symbolic-budgie/*.svg ${THEME_DIR}/status/symbolic
fi
if [[ ${color} == '-light' ]]; then
mkdir -p ${THEME_DIR}/status
cp -r ${SRC_DIR}/src/status/{16,22,24,32} ${THEME_DIR}/status
sed -i "s/#f2f2f2/#363636/g" "${THEME_DIR}"/status/{16,22,24,32}/*
cp -r ${SRC_DIR}/links/status/{16,22,24,32} ${THEME_DIR}/status
cd ${dest}
ln -s ../${name}${theme}/actions ${name}${theme}-light/actions
ln -s ../${name}${theme}/animations ${name}${theme}-light/animations
ln -s ../${name}${theme}/apps ${name}${theme}-light/apps
ln -s ../${name}${theme}/categories ${name}${theme}-light/categories
ln -s ../${name}${theme}/devices ${name}${theme}-light/devices
ln -s ../${name}${theme}/emotes ${name}${theme}-light/emotes
ln -s ../${name}${theme}/emblems ${name}${theme}-light/emblems
ln -s ../${name}${theme}/mimes ${name}${theme}-light/mimes
ln -s ../${name}${theme}/places ${name}${theme}-light/places
ln -s ../../${name}${theme}/status/symbolic ${name}${theme}-light/status/symbolic
fi
if [[ ${color} == '-dark' ]]; then
mkdir -p ${THEME_DIR}/{apps,categories,emblems,devices,mimes,places,status}
cp -r ${SRC_DIR}/src/actions ${THEME_DIR}
cp -r ${SRC_DIR}/src/apps/{22,32,symbolic} ${THEME_DIR}/apps
cp -r ${SRC_DIR}/src/categories/{22,symbolic} ${THEME_DIR}/categories
cp -r ${SRC_DIR}/src/emblems/symbolic ${THEME_DIR}/emblems
cp -r ${SRC_DIR}/src/mimes/symbolic ${THEME_DIR}/mimes
cp -r ${SRC_DIR}/src/devices/{16,22,24,32,symbolic} ${THEME_DIR}/devices
cp -r ${SRC_DIR}/src/places/{16,22,24,symbolic} ${THEME_DIR}/places
cp -r ${SRC_DIR}/src/status/symbolic ${THEME_DIR}/status
# Change icon color for dark theme
sed -i "s/#363636/#dedede/g" "${THEME_DIR}"/{actions,devices,places}/{16,22,24}/*
sed -i "s/#363636/#dedede/g" "${THEME_DIR}"/apps/{22,32}/*
sed -i "s/#363636/#dedede/g" "${THEME_DIR}"/categories/22/*
sed -i "s/#363636/#dedede/g" "${THEME_DIR}"/{actions,devices}/32/*
sed -i "s/#363636/#dedede/g" "${THEME_DIR}"/{actions,apps,categories,emblems,devices,mimes,places,status}/symbolic/*
cp -r ${SRC_DIR}/links/actions/{16,22,24,32,symbolic} ${THEME_DIR}/actions
cp -r ${SRC_DIR}/links/devices/{16,22,24,32,symbolic} ${THEME_DIR}/devices
cp -r ${SRC_DIR}/links/places/{16,22,24,symbolic} ${THEME_DIR}/places
cp -r ${SRC_DIR}/links/apps/symbolic ${THEME_DIR}/apps
cp -r ${SRC_DIR}/links/categories/symbolic ${THEME_DIR}/categories
cp -r ${SRC_DIR}/links/mimes/symbolic ${THEME_DIR}/mimes
cp -r ${SRC_DIR}/links/status/symbolic ${THEME_DIR}/status
cd ${dest}
ln -s ../${name}${theme}/animations ${name}${theme}-dark/animations
ln -s ../${name}${theme}/emotes ${name}${theme}-dark/emotes
ln -s ../../${name}${theme}/categories/32 ${name}${theme}-dark/categories/32
ln -s ../../${name}${theme}/emblems/16 ${name}${theme}-dark/emblems/16
ln -s ../../${name}${theme}/emblems/22 ${name}${theme}-dark/emblems/22
ln -s ../../${name}${theme}/emblems/24 ${name}${theme}-dark/emblems/24
ln -s ../../${name}${theme}/mimes/16 ${name}${theme}-dark/mimes/16
ln -s ../../${name}${theme}/mimes/22 ${name}${theme}-dark/mimes/22
ln -s ../../${name}${theme}/mimes/scalable ${name}${theme}-dark/mimes/scalable
ln -s ../../${name}${theme}/apps/scalable ${name}${theme}-dark/apps/scalable
ln -s ../../${name}${theme}/devices/scalable ${name}${theme}-dark/devices/scalable
ln -s ../../${name}${theme}/places/scalable ${name}${theme}-dark/places/scalable
ln -s ../../${name}${theme}/status/16 ${name}${theme}-dark/status/16
ln -s ../../${name}${theme}/status/22 ${name}${theme}-dark/status/22
ln -s ../../${name}${theme}/status/24 ${name}${theme}-dark/status/24
ln -s ../../${name}${theme}/status/32 ${name}${theme}-dark/status/32
cd ${THEME_DIR}
sed -i "s/Numix-Circle-Light/Numix-Circle/g" index.theme
fi
(
cd ${THEME_DIR}
ln -sf actions actions@2x
ln -sf animations animations@2x
ln -sf apps apps@2x
ln -sf categories categories@2x
ln -sf devices devices@2x
ln -sf emotes emotes@2x
ln -sf emblems emblems@2x
ln -sf mimes mimes@2x
ln -sf places places@2x
ln -sf status status@2x
)
gtk-update-icon-cache ${THEME_DIR}
}
themes=()
colors=()
if [[ "${#themes[@]}" -eq 0 ]]; then
themes=("${THEME_VARIANTS[0]}")
fi
if [[ "${#colors[@]}" -eq 0 ]]; then
colors=("${COLOR_VARIANTS[@]}")
fi
while [[ $# -gt 0 ]]; do
case "${1}" in
-d|--dest)
dest="${2}"
if [[ ! -d "${dest}" ]]; then
echo "ERROR: Destination directory does not exist."
exit 1
fi
shift 2
;;
-n|--name)
name="${2}"
shift 2
;;
-c|--circle)
circle='true'
;;
-a|--all)
themes=("${THEME_VARIANTS[@]}")
;;
-w|--white)
white="true"
;;
-t|--theme)
shift
for theme in "${@}"; do
case "${theme}" in
default)
themes+=("${THEME_VARIANTS[0]}")
shift
;;
red)
themes+=("${THEME_VARIANTS[1]}")
shift
;;
pink)
themes+=("${THEME_VARIANTS[2]}")
shift
;;
purple)
themes+=("${THEME_VARIANTS[3]}")
shift
;;
blue)
themes+=("${THEME_VARIANTS[4]}")
shift
;;
green)
themes+=("${THEME_VARIANTS[5]}")
shift
;;
yellow)
themes+=("${THEME_VARIANTS[6]}")
shift
;;
orange)
themes+=("${THEME_VARIANTS[7]}")
shift
;;
brown)
themes+=("${THEME_VARIANTS[8]}")
shift
;;
grey)
themes+=("${THEME_VARIANTS[9]}")
shift
;;
black)
themes+=("${THEME_VARIANTS[10]}")
shift
;;
all)
themes+=("${THEME_VARIANTS[@]}")
shift
;;
-*|--*)
break
;;
*)
echo "ERROR: Unrecognized theme variant '$1'."
echo "Try '$0 --help' for more information."
exit 1
;;
esac
done
;;
-h|--help)
usage
exit 0
;;
*)
echo "ERROR: Unrecognized installation option '$1'."
echo "Try '$0 --help' for more information."
exit 1
;;
esac
shift
done
install_theme() {
for theme in "${themes[@]}"; do
for color in "${colors[@]}"; do
install "${dest:-${DEST_DIR}}" "${name:-${THEME_NAME}}" "${theme}" "${color}"
done
done
}
install_theme