forked from B00merang-Project/Shell-Scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gtk-compile
executable file
·82 lines (60 loc) · 1.72 KB
/
gtk-compile
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
#!/bin/bash
# based on http://wibblystuff.blogspot.ca/2012/06/building-binary-for-gtk3-theme.html
echo 'To use this script you must have the follwowing packages installed:
libgtk-3-dev
libglib2.0-dev
libgdk-pixbuf2.0-dev
libxml2-utils
run sudo apt install -y libgtk-3-dev libglib2.0-dev libgdk-pixbuf2.0-dev libxml2-utils to install them now'
read -p "Enter path to theme gtk-3.0 folder: " "path"
cd "$path"
read -p "Enter theme name: " "theme"
mkdir "$PWD.bak"
cp * -r "$PWD.bak" # backup copy
cp gtk.css gtk-main.css
if [ -a gtk-dark.css ]; then
cp gtk-dark.css gtk-dark-main.css
fi
file="$PWD/gtk.gresource.xml"
header='<?xml version="1.0" encoding="UTF-8"?>\n<gresources>\n<gresource prefix="/org/gnome/'
post='">'
echo -e "$header$theme$post" >> "$file"
# for D in *; do find "$D" -type d; done #list all firs, type f for files
sub_append() {
for F in *; do
if [[ $F == *.css ]]; then
echo "<file>$1/$F</file>" >> "$file"
elif [[ $F == *.png ]]; then
echo "<file preprocess='to-pixdata'>$1/$F</file>" >> "$file"
fi
done
}
append() {
for F in *; do
if [[ $F == *.css ]]; then
echo "<file>$F</file>" >> "$file"
elif [[ $F == *.png ]]; then
echo "<file preprocess='to-pixdata'>$F</file>" >> "$file"
fi
done
}
for D in *; do
if [ -d "${D}" ]; then
cd "${D}"
echo "${D}"
sub_append "${D}"
cd ..
fi
done
# current directory
append
echo -e "</gresource>\n</gresources>" >> "$file"
glib-compile-resources gtk.gresource.xml
printf '@import url("resource:///org/gnome/' >> gtk.css
printf "$theme" >> gtk.css
printf '/gtk-main.css");' >> gtk.css
if [ -a gtk-dark.css ]; then
printf '@import url("resource:///org/gnome/' >> gtk-dark.css
printf "$theme" >> gtk-dark.css
printf '/gtk-dark-main.css");' >> gtk-dark.css
fi