Debian Codegraph @

cursors-src/bloom-dark/build.sh

raw
1 #!/bin/bash
2 # Open initial output.
3 # Prefer konsole if its there, otherwise fall back to xterminal.
4 #tty -s; if [ $? -ne 0 ]; then
5 # if command -v konsole &>/dev/null; then
6 # konsole -e "$0"; exit;
7 # else
8 # xterm -e "$0"; exit;
9 # fi
10 #fi
11
12 cd "$( dirname "${BASH_SOURCE[0]}" )"
13 RAWSVG="src/cursors.svg"
14 INDEX="src/cursor.theme"
15 ALIASES="src/cursorList"
16
17
18 echo -ne "Checking Requirements...\\r"
19 if [ ! -f $RAWSVG ] ; then
20 echo -e "\\nFAIL: '$RAWSVG' missing in /src"
21 exit 1
22 fi
23
24 if [ ! -f $INDEX ] ; then
25 echo -e "\\nFAIL: '$INDEX' missing in /src"
26 exit 1
27 fi
28
29 if ! type "inkscape" > /dev/null ; then
30 echo -e "\\nFAIL: inkscape must be installed"
31 exit 1
32 fi
33
34 if ! type "xcursorgen" > /dev/null ; then
35 echo -e "\\nFAIL: xcursorgen must be installed"
36 exit 1
37 fi
38 echo -e "Checking Requirements... DONE"
39
40
41
42 echo -ne "Making Folders... $BASENAME\\r"
43 DIR2X="build/x2"
44 DIR1_5X="build/x1_5"
45 DIR1X="build/x1"
46 OUTPUT="$(grep --only-matching --perl-regex "(?<=Name\=).*$" $INDEX)"
47 OUTPUT=../../${OUTPUT// /_}
48 mkdir -p "$DIR2X"
49 mkdir -p "$DIR1_5X"
50 mkdir -p "$DIR1X"
51 mkdir -p "$OUTPUT/cursors"
52 echo 'Making Folders... DONE';
53
54
55
56 for CUR in src/config/*.cursor; do
57 BASENAME=$CUR
58 BASENAME=${BASENAME##*/}
59 BASENAME=${BASENAME%.*}
60
61 echo -ne "\033[0KGenerating simple cursor pixmaps... $BASENAME\\r"
62
63 if [ "$DIR1X/$BASENAME.png" -ot $RAWSVG ] ; then
64 inkscape -i $BASENAME -d 96 -f $RAWSVG -e "$DIR1X/$BASENAME.png" > /dev/null
65 fi
66
67 if [ "$DIR1_5X/$BASENAME.png" -ot $RAWSVG ] ; then
68 inkscape -i $BASENAME -d 144 -f $RAWSVG -e "$DIR1_5X/$BASENAME.png" > /dev/null
69 fi
70
71 if [ "$DIR2X/$BASENAME.png" -ot $RAWSVG ] ; then
72 inkscape -i $BASENAME -d 192 -f $RAWSVG -e "$DIR2X/$BASENAME.png" > /dev/null
73 fi
74 done
75 echo -e "\033[0KGenerating simple cursor pixmaps... DONE"
76
77
78
79 for i in 01 02 03 04 05 06 07 08
80 do
81 echo -ne "\033[0KGenerating animated cursor pixmaps... $i / 8 \\r"
82
83 if [ "$DIR1X/progress-$i.png" -ot $RAWSVG ] ; then
84 inkscape -i progress-$i -d 96 -f $RAWSVG -e "$DIR1X/progress-$i.png" > /dev/null
85 fi
86
87 if [ "$DIR1_5X/progress-$i.png" -ot $RAWSVG ] ; then
88 inkscape -i progress-$i -d 144 -f $RAWSVG -e "$DIR1_5X/progress-$i.png" > /dev/null
89 fi
90
91 if [ "$DIR2X/progress-$i.png" -ot $RAWSVG ] ; then
92 inkscape -i progress-$i -d 192 -f $RAWSVG -e "$DIR2X/progress-$i.png" > /dev/null
93 fi
94
95 if [ "$DIR1X/default-$i.png" -ot $RAWSVG ] ; then
96 inkscape -i default-$i -d 96 -f $RAWSVG -e "$DIR1X/default-$i.png" > /dev/null
97 fi
98
99 if [ "$DIR1_5X/default-$i.png" -ot $RAWSVG ] ; then
100 inkscape -i default-$i -d 144 -f $RAWSVG -e "$DIR1_5X/default-$i.png" > /dev/null
101 fi
102
103 if [ "$DIR2X/default-$i.png" -ot $RAWSVG ] ; then
104 inkscape -i default-$i -d 192 -f $RAWSVG -e "$DIR2X/default-$i.png" > /dev/null
105 fi
106 if [ "$DIR1X/wait-$i.png" -ot $RAWSVG ] ; then
107 inkscape -i wait-$i -d 96 -f $RAWSVG -e "$DIR1X/wait-$i.png" > /dev/null
108 fi
109
110 if [ "$DIR1_5X/wait-$i.png" -ot $RAWSVG ] ; then
111 inkscape -i wait-$i -d 144 -f $RAWSVG -e "$DIR1_5X/wait-$i.png" > /dev/null
112 fi
113
114 if [ "$DIR2X/wait-$i.png" -ot $RAWSVG ] ; then
115 inkscape -i wait-$i -d 192 -f $RAWSVG -e "$DIR2X/wait-$i.png" > /dev/null
116 fi
117 done
118
119 for i in 09 10 11 12 13 14 15 16
120 do
121 echo -ne "\033[0KGenerating animated cursor pixmaps... $i / 16 \\r"
122
123 if [ "$DIR1X/wait-$i.png" -ot $RAWSVG ] ; then
124 inkscape -i wait-$i -d 96 -f $RAWSVG -e "$DIR1X/wait-$i.png" > /dev/null
125 fi
126
127 if [ "$DIR1_5X/wait-$i.png" -ot $RAWSVG ] ; then
128 inkscape -i wait-$i -d 144 -f $RAWSVG -e "$DIR1_5X/wait-$i.png" > /dev/null
129 fi
130
131 if [ "$DIR2X/wait-$i.png" -ot $RAWSVG ] ; then
132 inkscape -i wait-$i -d 192 -f $RAWSVG -e "$DIR2X/wait-$i.png" > /dev/null
133
134 fi
135
136 if [ "$DIR1X/default-$i.png" -ot $RAWSVG ] ; then
137 inkscape -i default-$i -d 96 -f $RAWSVG -e "$DIR1X/default-$i.png" > /dev/null
138 fi
139
140 if [ "$DIR1_5X/default-$i.png" -ot $RAWSVG ] ; then
141 inkscape -i default-$i -d 144 -f $RAWSVG -e "$DIR1_5X/default-$i.png" > /dev/null
142 fi
143
144 if [ "$DIR2X/default-$i.png" -ot $RAWSVG ] ; then
145 inkscape -i default-$i -d 192 -f $RAWSVG -e "$DIR2X/default-$i.png" > /dev/null
146
147 fi
148 done
149 echo -e "\033[0KGenerating animated cursor pixmaps... DONE"
150
151
152
153 echo -ne "Generating cursor theme...\\r"
154 for CUR in src/config/*.cursor; do
155 BASENAME=$CUR
156 BASENAME=${BASENAME##*/}
157 BASENAME=${BASENAME%.*}
158
159 ERR="$( xcursorgen -p build "$CUR" "$OUTPUT/cursors/$BASENAME" 2>&1 )"
160
161 if [[ "$?" -ne "0" ]]; then
162 echo "FAIL: $CUR $ERR"
163 fi
164 done
165 echo -e "Generating cursor theme... DONE"
166
167
168
169 echo -ne "Generating shortcuts...\\r"
170 while read ALIAS ; do
171 FROM=${ALIAS% *}
172 TO=${ALIAS#* }
173
174 if [ -e "$OUTPUT/cursors/$FROM" ] ; then
175 continue
176 fi
177
178 ln -s "$TO" "$OUTPUT/cursors/$FROM"
179 done < $ALIASES
180 echo -e "\033[0KGenerating shortcuts... DONE"
181
182
183
184 echo -ne "Copying Theme Index...\\r"
185 if ! [ -e "$OUTPUT/$INDEX" ] ; then
186 cp $INDEX "$OUTPUT/cursor.theme"
187 fi
188 echo -e "\033[0KCopying Theme Index... DONE"
189
190
191
192 echo "COMPLETE!"