| 1 | #!/bin/bash |
| 2 | # |
| 3 | # Description: |
| 4 | # A script for quick generation of symlinks of an in-development icon theme |
| 5 | # |
| 6 | # Legal Stuff: |
| 7 | # |
| 8 | # This script is free software; you can redistribute it and/or modify it under |
| 9 | # the terms of the GNU General Public License as published by the Free Software |
| 10 | # Foundation; version 3. |
| 11 | # |
| 12 | # This script is distributed in the hope that it will be useful, but WITHOUT |
| 13 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
| 14 | # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more |
| 15 | # details. |
| 16 | # |
| 17 | # You should have received a copy of the GNU General Public License along with |
| 18 | # this program; if not, see <https://www.gnu.org/licenses/gpl-3.0.txt> |
| 19 | |
| 20 | |
| 21 | DIR=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P ) |
| 22 | THEME="Paper" |
| 23 | |
| 24 | # echo $DIR |
| 25 | |
| 26 | # Icon sizes and contexts |
| 27 | CONTEXTS=("actions" "apps" "devices" "categories" "mimetypes" "places" "status") |
| 28 | SIZES=("8x8" "16x16" "24x24" "32x32" "48x48" "512x512" "8x8@2x" "16x16@2x" "24x24@2x" "32x32@2x" "48x48@2x" "512x512@2x") |
| 29 | |
| 30 | # Fullcolor icons |
| 31 | echo "Generating links for bitmap icons..." |
| 32 | # contexts for loop |
| 33 | for CONTEXT in "${CONTEXTS[@]}" |
| 34 | do |
| 35 | echo " -- "${CONTEXT} |
| 36 | # Sizes Loop |
| 37 | for SIZE in "${SIZES[@]}" |
| 38 | do |
| 39 | LIST="$DIR/bitmaps/$CONTEXT.list" |
| 40 | # Check if directory exists |
| 41 | if [ -d "$DIR/../../$THEME/$SIZE/$CONTEXT" ]; then |
| 42 | cd $DIR/../../$THEME/$SIZE/$CONTEXT |
| 43 | while read line; |
| 44 | do |
| 45 | ln -sf $line |
| 46 | done < $LIST |
| 47 | cd $DIR/../../$THEME |
| 48 | else |
| 49 | echo " -- skipping "$SIZE"/"$CONTEXT |
| 50 | fi |
| 51 | done |
| 52 | done |
| 53 | echo "Done." |
| 54 | |
| 55 | # Symbolic icons |
| 56 | echo "Generating links for panel icons..." |
| 57 | # contexts for loop |
| 58 | PANELDIRS=("animations", "indicator-keyboard") |
| 59 | PANELSIZES=("22x22", "24x24") |
| 60 | PANELTHEMES=("Paper", "Paper-Mono-Dark") |
| 61 | for CONTEXT in "${PANELDIRS[@]}" |
| 62 | do |
| 63 | echo " -- "$CONTEXT |
| 64 | # Sizes Loop |
| 65 | for SIZE in "${PANELSIZES[@]}" |
| 66 | do |
| 67 | # Get list file |
| 68 | LIST="$DIR/panel/$CONTEXT.list" |
| 69 | # for both panel themes |
| 70 | for VAR in "${PANELTHEMES[@]}" |
| 71 | do |
| 72 | # Check if directory exists |
| 73 | if [ -d "$DIR/../../$VAR/$SIZE/$CONTEXT" ]; then |
| 74 | cd $DIR/../../$VAR/$SIZE/$CONTEXT |
| 75 | while read line; |
| 76 | do |
| 77 | ln -sf $line |
| 78 | done < $LIST |
| 79 | cd $DIR/../../$VAR |
| 80 | else |
| 81 | echo " -- skipping panel/"$CONTEXT |
| 82 | fi |
| 83 | done |
| 84 | done |
| 85 | done |
| 86 | echo "Done." |
| 87 | |
| 88 | # Icon sizes and contexts |
| 89 | CONTEXTS=("actions" "apps" "devices" "categories" "mimetypes" "places" "status") |
| 90 | SIZES=("scalable") |
| 91 | |
| 92 | # Fullcolor icons |
| 93 | echo "Generating links for bitmap icons..." |
| 94 | # contexts for loop |
| 95 | for CONTEXT in "${CONTEXTS[@]}" |
| 96 | do |
| 97 | echo " -- "${CONTEXT} |
| 98 | # Sizes Loop |
| 99 | for SIZE in "${SIZES[@]}" |
| 100 | do |
| 101 | LIST="$DIR/scalable/$CONTEXT.list" |
| 102 | # Check if directory exists |
| 103 | if [ -d "$DIR/../../$THEME/$SIZE/$CONTEXT" ]; then |
| 104 | cd $DIR/../../$THEME/$SIZE/$CONTEXT |
| 105 | while read line; |
| 106 | do |
| 107 | ln -sf $line |
| 108 | done < $LIST |
| 109 | cd $DIR/../../$THEME |
| 110 | else |
| 111 | echo " -- skipping "$SIZE"/"$CONTEXT |
| 112 | fi |
| 113 | done |
| 114 | done |
| 115 | echo "Done." |
| 116 | |
| 117 | |
| 118 | # echo $DIR |
| 119 | # Clear symlink errors |
| 120 | if command -v symlinks 2>&1 >/dev/null; then |
| 121 | echo "Deleting broken links..." |
| 122 | symlinks -cdr cd $DIR/../../$THEME |
| 123 | echo "Done." |
| 124 | fi |