File indexing completed on 2024-04-28 05:26:16
0001 #!/bin/bash 0002 # Open initial output. 0003 # Prefer konsole if its there, otherwise fall back to xterminal. 0004 #tty -s; if [ $? -ne 0 ]; then 0005 # if command -v konsole &>/dev/null; then 0006 # konsole -e "$0"; exit; 0007 # else 0008 # xterm -e "$0"; exit; 0009 # fi 0010 #fi 0011 0012 cd "$( dirname "${BASH_SOURCE[0]}" )" 0013 RAWSVG="src/cursors.svg" 0014 INDEX="src/index.theme" 0015 ALIASES="src/cursorList" 0016 0017 0018 echo -ne "Checking Requirements...\\r" 0019 if [ ! -f $RAWSVG ] ; then 0020 echo -e "\\nFAIL: '$RAWSVG' missing in /src" 0021 exit 1 0022 fi 0023 0024 if [ ! -f $INDEX ] ; then 0025 echo -e "\\nFAIL: '$INDEX' missing in /src" 0026 exit 1 0027 fi 0028 0029 if ! type "inkscape" > /dev/null ; then 0030 echo -e "\\nFAIL: inkscape must be installed" 0031 exit 1 0032 fi 0033 0034 if ! type "xcursorgen" > /dev/null ; then 0035 echo -e "\\nFAIL: xcursorgen must be installed" 0036 exit 1 0037 fi 0038 echo -e "Checking Requirements... DONE" 0039 0040 SCALES="50 75 100 125 150 175 200 225 250 275 300" 0041 0042 echo -ne "Making Folders... $BASENAME\\r" 0043 OUTPUT="$(grep --only-matching --perl-regex "(?<=Name\=).*$" $INDEX)" 0044 OUTPUT=${OUTPUT// /_} 0045 for scale in $SCALES; do 0046 mkdir -p "build/x$scale" 0047 done 0048 mkdir -p "$OUTPUT/cursors" 0049 echo 'Making Folders... DONE'; 0050 0051 0052 0053 for CUR in src/config/*.cursor; do 0054 BASENAME=$CUR 0055 BASENAME=${BASENAME##*/} 0056 BASENAME=${BASENAME%.*} 0057 0058 echo -ne "\033[0KGenerating simple cursor pixmaps... $BASENAME\\r" 0059 0060 for scale in $SCALES; do 0061 DIR="build/x$scale" 0062 if [ "$DIR/$BASENAME.png" -ot $RAWSVG ] ; then 0063 inkscape $RAWSVG -i $BASENAME -w $((32*$scale/100)) -h $((32*$scale/100)) -o "$DIR/$BASENAME.png" > /dev/null 0064 fi 0065 done 0066 done 0067 echo -e "\033[0KGenerating simple cursor pixmaps... DONE" 0068 0069 0070 0071 for i in 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 0072 do 0073 echo -ne "\033[0KGenerating animated cursor pixmaps... $i / 23 \\r" 0074 0075 for scale in $SCALES; do 0076 DIR="build/x$scale" 0077 0078 if [ "$DIR/progress-$i.png" -ot $RAWSVG ] ; then 0079 inkscape $RAWSVG -i progress-$i -w $((32*$scale/100)) -h $((32*$scale/100)) -o "$DIR/progress-$i.png" > /dev/null 0080 fi 0081 0082 if [ "$DIR/wait-$i.png" -ot $RAWSVG ] ; then 0083 inkscape $RAWSVG -i wait-$i -w $((32*$scale/100)) -h $((32*$scale/100)) -o "$DIR/wait-$i.png" > /dev/null 0084 fi 0085 done 0086 done 0087 echo -e "\033[0KGenerating animated cursor pixmaps... DONE" 0088 0089 0090 0091 echo -ne "Generating cursor theme...\\r" 0092 for CUR in src/config/*.cursor; do 0093 BASENAME=$CUR 0094 BASENAME=${BASENAME##*/} 0095 BASENAME=${BASENAME%.*} 0096 0097 TMP_CUR="tmp.cursor" 0098 ./scale_cursor $CUR $SCALES > $TMP_CUR 0099 ERR="$( xcursorgen -p build "$TMP_CUR" "$OUTPUT/cursors/$BASENAME" 2>&1 )" 0100 rm $TMP_CUR 0101 0102 if [[ "$?" -ne "0" ]]; then 0103 echo "FAIL: $CUR $ERR" 0104 fi 0105 done 0106 echo -e "Generating cursor theme... DONE" 0107 0108 0109 0110 echo -ne "Generating shortcuts...\\r" 0111 while read ALIAS ; do 0112 FROM=${ALIAS% *} 0113 TO=${ALIAS#* } 0114 0115 if [ -e "$OUTPUT/cursors/$FROM" ] ; then 0116 continue 0117 fi 0118 0119 ln -s "$TO" "$OUTPUT/cursors/$FROM" 0120 done < $ALIASES 0121 echo -e "\033[0KGenerating shortcuts... DONE" 0122 0123 0124 0125 echo -ne "Copying Theme Index...\\r" 0126 if ! [ -e "$OUTPUT/$INDEX" ] ; then 0127 cp $INDEX "$OUTPUT/index.theme" 0128 fi 0129 echo -e "\033[0KCopying Theme Index... DONE" 0130 0131 0132 0133 echo "COMPLETE!"