blob: 72f2be149cc420068440212a6482b49bb1cf5729 (
plain)
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
|
#!/bin/bash
DESTDIR=${DESTDIR:-/}
colors=(Brave Dust Human Illustrious Noble Wine Wise)
properties=(bg fg base text selected_bg selected_fg tooltip_bg tooltip_fg frame inactive_frame menubar_bg menubar_fg menuitem_fg)
common_bg=#d8d8d8
common_fg=#101010
common_base=#ffffff
common_text=#1a1a1a
common_menubar_bg=#212121
common_menubar_fg=#cecece
common_menuitem_fg=#ffffff
Dust_menubar_bg=#27241F
Brave_selected_bg=#729fcf
Dust_selected_bg=#b49372
Human_selected_bg=#f7a145
Illustrious_selected_bg=#f08290
Noble_selected_bg=#ad7fa8
Wine_selected_bg=#de4e4e
Wise_selected_bg=#97bf60
common_selected_fg=#ffffff
common_tooltip_bg=#f5f5b5
common_tooltip_fg=#000000
common_frame=#333333
common_inactive_frame=#333333
shopt -s globstar dotglob extglob
#sed() {
# [[ "$debug" == true ]] && echo "sed $@"
# command sed "$@"
#}
debug() {
[[ "$debug" ]] && echo "$@"
}
install_plank_theme() {
[[ ! -d "$1" ]] && mkdir -p "$1"
plank_dir="$1"
shift
cp -vr "$@" "$plank_dir"
}
install_theme() {
[[ ! -d "zuki-themes" ]] && update
for color in ${colors[@]};do
if [[ -d "Shiki-$color" ]];then
printf "Installing \"Shiki-$color\""
if [[ "$user_install" ]];then
printf "...\n"
cp -r "Shiki-$color/" "$DESTDIR$HOME/.themes"
else
echo " system-wide..."
mkdir -p "$DESTDIR/usr/share/themes/"
cp -vr "$PWD/Shiki-$color/" "$DESTDIR/usr/share/themes/"
fi
else
generate_theme "$color"
fi
done
if [[ "$user_install" ]];then
echo "Installing Xfwm themes..."
cp -vr Shiki-*-Xfwm/ "$DESTDIR$HOME/.themes"
echo "Installing Openbox themes..."
cp -vr Shiki-*-Openbox/ "$DESTDIR$HOME/.themes"
echo "Installing Plank themes..."
install_plank_theme "$DESTDIR$HOME/.local/share/plank/themes/" ./plank/*
else
echo "Installing Xfwm themes system-wide..."
mkdir -p "$DESTDIR/usr/share/themes/"
cp -vr "$PWD"/Shiki-*-Xfwm/ "$DESTDIR/usr/share/themes/"
echo "Installing Openbox themes system-wide..."
cp -vr "$PWD"/Shiki-*-Openbox/ "$DESTDIR/usr/share/themes/"
echo "Installing Plank themes system-wide..."
install_plank_theme "$DESTDIR/usr/share/plank/themes/" ./plank/*
fi
printf '\n'
}
uninstall_theme() {
printf "Uninstalling..."
for color in ${colors[@]};do
printf " \"Shiki-$color\""
rm -rf "$DESTDIR$HOME/.themes/Shiki-$color/" "$DESTDIR/usr/share/themes/Shiki-$color/"
done
printf '\nRemoving Plank themes...'
for theme in plank/*;do
theme=$(basename "$theme")
printf " \"$theme\""
rm -rf "$DESTDIR$HOME/.local/share/plank/themes/$theme" "$DESTDIR/usr/share/plank/themes/$theme"
done
printf '\n\n'
}
fix_line_endings() {
printf "Correcting line endings..."
for file in $@;do
printf " \"$(basename $file)\""
sed -i.bak 's/\r//' "$file"
done
printf '\n\n'
}
patch() {
if [[ "$debug" ]];then
command patch --verbose "$@"
else
command patch "$@"
fi
}
patch_theme() {
echo "Patching zuki-themes..."
echo "If these files were already patched before, you'll see errors. Ignore them."
cd zuki-themes
echo "Resetting zuki-themes git repo..."
git reset --hard HEAD
cd "$OLDPWD"
fix_line_endings "./zuki-themes/Zukitwo/gtk-2.0/widgets/panel.rc" "./zuki-themes/Zukitwo/gtk-2.0/gtkrc" "./Shiki-colors-common/patches/panel.rc.patch" "./Shiki-colors-common/patches/enable-dark-menubar.patch"
yes | patch ./zuki-themes/Zukitwo/gtk-2.0/widgets/panel.rc <./Shiki-colors-common/patches/panel.rc.patch
yes | patch ./zuki-themes/Zukitwo/gtk-2.0/gtkrc <./Shiki-colors-common/patches/enable-dark-menubar.patch
for zuki_theme in ./zuki-themes/*/;do
pushd "$zuki_theme/" >/dev/null 2>&1
rm -rf "xfwm4"
popd >/dev/null 2>&1
done
OLDIFS="$IFS"
IFS=$'\n'
for file in $(find ./zuki-themes/ -type f);do
sed -i 's/gtk_color_scheme = ./gtk_color_scheme = \"menubar_bg_color:#ffffff\\nmenubar_fg_color:#ffffff\\nmenuitem_fg_color:#ffffff\\n/g' "$file"
done
printf "\n"
IFS="$OLDIFS"
OLDIFS=
}
generate_theme() {
if [[ ! -d "zuki-themes/" ]];then
echo "zuki-themes does not exist. You need to run \`./make-color-themes update\`."
exit 1
fi
color="$1"
cp -r "zuki-themes/Zukitwo" "Shiki-$color"
cd "Shiki-$color"
echo "Creating \"Shiki-$color\"..."
file_list=$(find . -type f | grep -v 'make-colors-themes')
for property in ${properties[@]};do
property_var_name=\$${color}_$property
property_var_contents=$(echo \$${color}_bg)
if [[ -z "$(eval echo $property_var_name)" ]];then
debug " There is no \"$property_var_name\", so we'll just use \"\$common_$property\""
property_var_contents=$(eval echo \$common_$property)
else
debug " Using \"$property_var_name\""
property_var_contents="$(eval echo $property_var_name)"
fi
OLDIFS="$IFS"
IFS=$'\n'
property_var_contents=$(echo "$property_var_contents" | sed 's/\#/\\\#/g')
for file in ${file_list};do
sed -i "s/${property}_color:\#[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]/${property}_color:$property_var_contents/g;s/theme_${property}_color \#[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]/theme_${property}_color $property_var_contents/g;s/Zukitwo/Shiki-$color/g;s/define-color theme_${property}_color .*\;/define-color theme_${property}_color $property_var_contents\;/g" "$file" 2>/dev/null >/dev/null
done
IFS="$OLDIFS"
done
#rm -rf "xfwm4"
cp -vr ../Shiki-colors-common/* ./
cd "$OLDPWD"
}
update() {
if [[ ! -d "zuki-themes/.git" ]];then
git submodule init zuki-themes/
git submodule update -f zuki-themes/
fi
echo "Resetting zuki-themes tree..."
git submodule deinit -f zuki-themes/
git submodule init zuki-themes/
echo "Getting latest revision of zuki-themes..."
git submodule update -f -- zuki-themes/
cd "$OLDPWD"
printf '\n\n'
}
clean() {
printf "Removing..."
for color in ${colors[@]};do
printf " \"Shiki-$color/\""
rm -rf "Shiki-$color/"
done
printf '\n\n'
}
help() {
echo "make-colors-themes - create Zukitwo-colors themes"
echo "usage: make-colors-themes [actions]"
echo
echo "arguments:"
echo " generate - just generate the theme"
echo " install - install the theme system-wide"
echo " user_install - install the theme in your ~/.themes directory"
echo " uninstall - uninstall the theme"
echo " clean - delete old generated files"
echo " patch - patch zuki-themes file"
echo " update - update the local copy of the zuki-themes repo"
echo " debug - activate debug messages"
echo " help - display this message"
echo
echo "edit the \$colors variables in the script if you'd like to only generate certain colors"
echo
exit
}
command_not_found() {
echo "make-colors-themes: \`$command\` is not a valid command"
}
generate_themes() {
generate=true
for theme in ${colors[@]};do
generate_theme $theme
done
printf "Now, type \`$0 install\` or \`$0 user_install\` to install.\n"
}
if [[ "$1" ]];then
while [[ "$1" ]];do
[[ "$1" == "generate" ]] && generate=true && generate_themes
[[ "$1" == "install" ]] && install=true && install_theme
[[ "$1" == "user-install" ]] && user_install=1 && install_theme
[[ "$1" == "update" ]] && update=true && update
[[ "$1" == "uninstall" ]] && uninstall=true && uninstall_theme
[[ "$1" == "clean" ]] && clean=true clean
[[ "$1" == "patch" ]] && patch=true && patch_theme
[[ "$1" == "debug" ]] && debug=true
[[ "$1" == "help" ]] && help=true && help
[[ ! "$help" && ! "$install" && ! "$user_install" && ! "$update" && ! "$uninstall" && ! "$clean" && ! "$patch" && ! "$debug" && ! "$generate" ]] && command_not_found=1 && command="$1"
shift
done
else
help
fi
|