File indexing completed on 2024-05-12 13:30:13
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 0041 0042 echo -ne "Making Folders... $BASENAME\\r" 0043 DIR2X="build/x2" 0044 DIR1_5X="build/x1_5" 0045 DIR1X="build/x1" 0046 OUTPUT="$(grep --only-matching --perl-regex "(?<=Name\=).*$" $INDEX)" 0047 OUTPUT=${OUTPUT// /_} 0048 mkdir -p "$DIR2X" 0049 mkdir -p "$DIR1_5X" 0050 mkdir -p "$DIR1X" 0051 mkdir -p "$OUTPUT/cursors" 0052 echo 'Making Folders... DONE'; 0053 0054 0055 0056 for CUR in src/config/*.cursor; do 0057 BASENAME=$CUR 0058 BASENAME=${BASENAME##*/} 0059 BASENAME=${BASENAME%.*} 0060 0061 echo -ne "\033[0KGenerating simple cursor pixmaps... $BASENAME\\r" 0062 0063 if [ "$DIR1X/$BASENAME.png" -ot $RAWSVG ] ; then 0064 inkscape -i $BASENAME -w 32 -h 32 -f $RAWSVG -e "$DIR1X/$BASENAME.png" > /dev/null 0065 fi 0066 0067 if [ "$DIR1_5X/$BASENAME.png" -ot $RAWSVG ] ; then 0068 inkscape -i $BASENAME -w 48 -h 48 -f $RAWSVG -e "$DIR1_5X/$BASENAME.png" > /dev/null 0069 fi 0070 0071 if [ "$DIR2X/$BASENAME.png" -ot $RAWSVG ] ; then 0072 inkscape -i $BASENAME -w 64 -h 64 -f $RAWSVG -e "$DIR2X/$BASENAME.png" > /dev/null 0073 fi 0074 done 0075 echo -e "\033[0KGenerating simple cursor pixmaps... DONE" 0076 0077 0078 0079 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 0080 do 0081 echo -ne "\033[0KGenerating animated cursor pixmaps... $i / 23 \\r" 0082 0083 if [ "$DIR1X/progress-$i.png" -ot $RAWSVG ] ; then 0084 inkscape -i progress-$i -w 32 -h 32 -f $RAWSVG -e "$DIR1X/progress-$i.png" > /dev/null 0085 fi 0086 0087 if [ "$DIR1_5X/progress-$i.png" -ot $RAWSVG ] ; then 0088 inkscape -i progress-$i -w 48 -h 48 -f $RAWSVG -e "$DIR1_5X/progress-$i.png" > /dev/null 0089 fi 0090 0091 if [ "$DIR2X/progress-$i.png" -ot $RAWSVG ] ; then 0092 inkscape -i progress-$i -w 64 -h 64 -f $RAWSVG -e "$DIR2X/progress-$i.png" > /dev/null 0093 fi 0094 0095 if [ "$DIR1X/wait-$i.png" -ot $RAWSVG ] ; then 0096 inkscape -i wait-$i -w 32 -h 32 -f $RAWSVG -e "$DIR1X/wait-$i.png" > /dev/null 0097 fi 0098 0099 if [ "$DIR1_5X/wait-$i.png" -ot $RAWSVG ] ; then 0100 inkscape -i wait-$i -w 48 -h 48 -f $RAWSVG -e "$DIR1_5X/wait-$i.png" > /dev/null 0101 fi 0102 0103 if [ "$DIR2X/wait-$i.png" -ot $RAWSVG ] ; then 0104 inkscape -i wait-$i -w 64 -h 64 -f $RAWSVG -e "$DIR2X/wait-$i.png" > /dev/null 0105 fi 0106 done 0107 echo -e "\033[0KGenerating animated cursor pixmaps... DONE" 0108 0109 0110 0111 echo -ne "Generating cursor theme...\\r" 0112 for CUR in src/config/*.cursor; do 0113 BASENAME=$CUR 0114 BASENAME=${BASENAME##*/} 0115 BASENAME=${BASENAME%.*} 0116 0117 ERR="$( xcursorgen -p build "$CUR" "$OUTPUT/cursors/$BASENAME" 2>&1 )" 0118 0119 if [[ "$?" -ne "0" ]]; then 0120 echo "FAIL: $CUR $ERR" 0121 fi 0122 done 0123 echo -e "Generating cursor theme... DONE" 0124 0125 0126 0127 echo -ne "Generating shortcuts...\\r" 0128 while read ALIAS ; do 0129 FROM=${ALIAS% *} 0130 TO=${ALIAS#* } 0131 0132 if [ -e "$OUTPUT/cursors/$FROM" ] ; then 0133 continue 0134 fi 0135 0136 ln -s "$TO" "$OUTPUT/cursors/$FROM" 0137 done < $ALIASES 0138 echo -e "\033[0KGenerating shortcuts... DONE" 0139 0140 0141 0142 echo -ne "Copying Theme Index...\\r" 0143 if ! [ -e "$OUTPUT/$INDEX" ] ; then 0144 cp $INDEX "$OUTPUT/index.theme" 0145 fi 0146 echo -e "\033[0KCopying Theme Index... DONE" 0147 0148 0149 0150 echo "COMPLETE!"