forked from vinceliuice/Matcha-gtk-theme
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Install
executable file
·222 lines (194 loc) · 9.31 KB
/
Install
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
#!/bin/bash
# Copying files
ROOT_UID=0
DEST_DIR=
# Destination directory
if [ "$UID" -eq "$ROOT_UID" ]; then
DEST_DIR="/usr/share/themes"
else
DEST_DIR="$HOME/.themes"
fi
REO_DIR=$(cd $(dirname $0) && pwd)
SRC_DIR=${REO_DIR}/src
THEME_NAME=Matcha
COLOR_VARIANTS=('' '-dark')
THEME_VARIANTS=('-aliz' '-azul' '-sea')
usage() {
printf "%s\n" "Usage: $0 [OPTIONS...]"
printf "\n%s\n" "OPTIONS:"
printf " %-25s%s\n" "-d, --dest DIR" "Specify theme destination directory (Default: ${DEST_DIR})"
printf " %-25s%s\n" "-n, --name NAME" "Specify theme name (Default: ${THEME_NAME})"
printf " %-25s%s\n" "-c, --color VARIANTS" "Specify theme color variant(s) [standard|dark] (Default: All variants)"
printf " %-25s%s\n" "-t, --theme VARIANTS" "Specify hue theme variant(s) [aliz|azul|sea] (Default: All variants)"
printf " %-25s%s\n" "-h, --help" "Show this help"
}
# Copying files
install() {
local dest=${1}
local name=${2}
local color=${3}
local theme=${4}
local themedir=${dest}/${name}${color}${theme}
[[ -d ${themedir} ]] && rm -rf ${themedir}
echo "Installing '${themedir}'..."
mkdir -p ${themedir}
# Install index.theme
echo "[Desktop Entry]" >> ${themedir}/index.theme
echo "Type=X-GNOME-Metatheme" >> ${themedir}/index.theme
echo "Name=${name}${color}${theme}" >> ${themedir}/index.theme
echo "Comment=A dark modern design theme" >> ${themedir}/index.theme
echo "Encoding=UTF-8" >> ${themedir}/index.theme
echo "" >> ${themedir}/index.theme
echo "[X-GNOME-Metatheme]" >> ${themedir}/index.theme
echo "GtkTheme=${name}${color}${theme}" >> ${themedir}/index.theme
echo "MetacityTheme=${name}${color}${theme}" >> ${themedir}/index.theme
echo "IconTheme=${name}" >> ${themedir}/index.theme
echo "CursorTheme=Breeze_cursors" >> ${themedir}/index.theme
echo "ButtonLayout=menu:minimize,maximize,close" >> ${themedir}/index.theme
# Install GNOME Shell Theme
mkdir -p ${themedir}/gnome-shell
cd ${SRC_DIR}/gnome-shell
cp -ur extensions ${themedir}/gnome-shell
cp -ur gnome-shell${color}${theme}.css ${themedir}/gnome-shell/gnome-shell.css
cp -ur common-assets ${themedir}/gnome-shell/assets
cd ${SRC_DIR}/gnome-shell/assets
cp -ur no-events${color}.svg ${themedir}/gnome-shell/assets/no-events.svg
cp -ur no-notifications${color}.svg ${themedir}/gnome-shell/assets/no-notifications.svg
cp -ur calendar-arrow-left${color}.svg ${themedir}/gnome-shell/assets/calendar-arrow-left.svg
cp -ur calendar-arrow-right${color}.svg ${themedir}/gnome-shell/assets/calendar-arrow-right.svg
cp -ur key-hide${color}.svg ${themedir}/gnome-shell/assets/key-hide.svg
cp -ur key-layout${color}.svg ${themedir}/gnome-shell/assets/key-layout.svg
cp -ur key-shift${color}.svg ${themedir}/gnome-shell/assets/key-shift.svg
cd ${themedir}/gnome-shell
ln -s assets/no-events.svg no-events.svg
ln -s assets/process-working.svg process-working.svg
ln -s assets/no-notifications.svg no-notifications.svg
# Install GTK+ 2 Theme
mkdir -p ${themedir}/gtk-2.0
cd ${SRC_DIR}/gtk-2.0
cp -ur {apps.rc,main.rc,panel.rc,xfce-notify.rc} ${themedir}/gtk-2.0
cp -ur gtkrc${color}${theme} ${themedir}/gtk-2.0/gtkrc
cp -ur assets${color}${theme} ${themedir}/gtk-2.0/assets
cp -ur menubar-toolbar${color}.rc ${themedir}/gtk-2.0/menubar-toolbar.rc
# Install GTK+ 3 Theme
mkdir -p ${themedir}/gtk-3.0
cd ${SRC_DIR}/gtk-3.0
cp -ur assets${theme} ${themedir}/gtk-3.0/assets
cp -ur gtk${color}${theme}.css ${themedir}/gtk-3.0/gtk.css
cp -ur gtk-dark${theme}.css ${themedir}/gtk-3.0/gtk-dark.css
cp -ur thumbnail${color}${theme}.png ${themedir}/gtk-3.0/thumbnail.png
# Install CINNAMON Theme
mkdir -p ${themedir}/cinnamon
cd ${SRC_DIR}/cinnamon
cp -ur cinnamon${color}${theme}.css ${themedir}/cinnamon/cinnamon.css
cp -ur thumbnail${color}${theme}.png ${themedir}/cinnamon/thumbnail.png
cd ${SRC_DIR}/cinnamon/assets${theme}
cp -ur common-assets ${themedir}/cinnamon
cp -ur assets${color} ${themedir}/cinnamon/assets
# Install Metacity Theme
mkdir -p ${themedir}/metacity-1
cd ${SRC_DIR}/metacity-1
cp -ur {thumbnail.png,*.svg,metacity-theme-3.xml} ${themedir}/metacity-1
cp -ur metacity-theme-1${theme}.xml ${themedir}/metacity-1/metacity-theme-1.xml
cd ${themedir}/metacity-1
ln -s metacity-theme-1.xml metacity-theme-2.xml
# Install xfwm4 Theme
mkdir -p ${themedir}/xfwm4
cd ${SRC_DIR}/xfwm4
cp -ur assets${color}${theme}/*.png ${themedir}/xfwm4
cp -ur themerc${theme} ${themedir}/xfwm4/themerc
# Install openbox Theme
mkdir -p ${themedir}/openbox-3
cd ${SRC_DIR}/openbox-3
cp -ur *.xbm ${themedir}/openbox-3
cp -ur themerc${color}${theme} ${themedir}/openbox-3/themerc
# Install Unity Theme
mkdir -p ${themedir}/unity
cd ${SRC_DIR}
cp -ur unity ${themedir}
}
# Install theme
install_theme() {
for color in "${colors[@]:-${COLOR_VARIANTS[@]}}"; do
for theme in "${themes[@]:-${THEME_VARIANTS[@]}}"; do
install "${dest:-${DEST_DIR}}" "${name:-${THEME_NAME}}" "${color}" "${theme}"
done
done
}
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
;;
-t|--theme)
shift
for theme in "${@}"; do
case "${theme}" in
aliz)
themes+=("${THEME_VARIANTS[0]}")
shift 1
;;
azul)
themes+=("${THEME_VARIANTS[1]}")
shift 1
;;
sea)
themes+=("${THEME_VARIANTS[2]}")
shift 1
;;
-*|--*)
break
;;
*)
echo "ERROR: Unrecognized thin variant '$1'."
echo "Try '$0 --help' for more information."
exit 1
;;
esac
done
;;
-c|--color)
shift
for color in "${@}"; do
case "${color}" in
standard)
colors+=("${COLOR_VARIANTS[0]}")
shift 1
;;
dark)
colors+=("${COLOR_VARIANTS[1]}")
shift 1
;;
-*|--*)
break
;;
*)
echo "ERROR: Unrecognized color 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
done
install_theme
echo "Finished!..."