diff options
Diffstat (limited to 'scalable/mimetypes/templates/generate.sh')
-rwxr-xr-x | scalable/mimetypes/templates/generate.sh | 63 |
1 files changed, 0 insertions, 63 deletions
diff --git a/scalable/mimetypes/templates/generate.sh b/scalable/mimetypes/templates/generate.sh deleted file mode 100755 index be8de9c..0000000 --- a/scalable/mimetypes/templates/generate.sh +++ /dev/null | |||
@@ -1,63 +0,0 @@ | |||
1 | DEFAULT_FILE='file' # .png gets added automatically | ||
2 | #INPUT_FILE=test-globs | ||
3 | #INPUT_FILE=/usr/share/mime/generic-icons < /usr/share/mime/globs | ||
4 | INPUT_FILE=$1 | ||
5 | OUT_PATH="../" | ||
6 | |||
7 | MAX_LINES=`cat $INPUT_FILE | wc -l` | ||
8 | CUR_LINE=0 | ||
9 | |||
10 | IFS=':' | ||
11 | while read A B | ||
12 | do | ||
13 | if [[ "$A" == "#"* ]]; then continue; fi | ||
14 | |||
15 | MIME=$A | ||
16 | FILE=${A/\//-} | ||
17 | TEXT=${B/\*\./} | ||
18 | |||
19 | |||
20 | ((CUR_LINE++)) | ||
21 | printf "[%-4d/%-4d] checking for %s\n" "$CUR_LINE" "$MAX_LINES" "$FILE.png" | ||
22 | |||
23 | if [[ -f "default/$FILE.png" ]]; then | ||
24 | echo "using default." | ||
25 | cp "default/$FILE.png" "$OUT_PATH/$FILE.png" | ||
26 | else | ||
27 | |||
28 | FIND=$FILE | ||
29 | while [[ 1 ]] | ||
30 | do | ||
31 | # printf "%s\n" $FIND | ||
32 | if [[ -f "default/$FIND.png" ]]; then break; fi | ||
33 | |||
34 | if [[ "$FIND" == "${FIND%-*}" ]]; then FIND="$DEFAULT_FILE"; break; fi | ||
35 | FIND=${FIND%-*} | ||
36 | done | ||
37 | |||
38 | # create default file... just in case there is no desktop file... | ||
39 | cp "default/$FIND.png" "$OUT_PATH/$FILE.png" | ||
40 | |||
41 | DESKTOP=`xdg-mime query default $MIME` | ||
42 | if [[ -f /usr/share/applications/$DESKTOP ]]; then | ||
43 | ICONTEXT=`grep -o 'Icon=.*' /usr/share/applications/$DESKTOP` | ||
44 | APPICON=`find ../../ /usr/share/icons/Adwaita/scalable /usr/share/icons/hicolor/scalable -path '*apps*' -name "${ICONTEXT/Icon=/}*" -type f -print -quit` | ||
45 | |||
46 | printf "%-12s%s\t%s\t%s\t%s\n" "" $MIME $DESKTOP $FIND $APPICON | ||
47 | |||
48 | if [[ "$APPICON" ]]; then | ||
49 | convert \ | ||
50 | "default/$FIND.png" \( -density 400 $APPICON -resize 256 \) \ | ||
51 | -gravity north -geometry +0+20 \ | ||
52 | -compose darken -composite $OUT_PATH/$FILE.png | ||
53 | fi | ||
54 | fi | ||
55 | fi | ||
56 | |||
57 | mogrify "$OUT_PATH/$FILE.png" \ | ||
58 | -gravity northwest -pointsize 60 -rotate 90 \ | ||
59 | -stroke '#444' -strokewidth 2 -annotate 0 "${FILE##*-}" \ | ||
60 | -fill '#ff0' -annotate 0 "${FILE##*-}" \ | ||
61 | -rotate -90 -resize 256 $OUT_PATH/$FILE.png | ||
62 | |||
63 | done < $INPUT_FILE | ||