-
Notifications
You must be signed in to change notification settings - Fork 28
/
Copy pathgenerate-symlinks.sh
executable file
·99 lines (88 loc) · 2.38 KB
/
generate-symlinks.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
#!/bin/bash
#
# Description:
# A script for quick generation of symlinks of an in-development icon theme
#
# Legal Stuff:
#
# This script is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation; version 3.
#
# This script is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, see <https://www.gnu.org/licenses/gpl-3.0.txt>
DIR=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P )
THEME="Pop"
# echo $DIR
# Icon sizes and contexts
CONTEXTS=("actions" "apps" "devices" "emblems" "categories" "mimetypes" "places" "status")
SIZES=("8x8" "16x16" "24x24" "32x32" "48x48" "64x64" "128x128" "256x256" "512x512")
SCALES=('@2x')
# Fullcolor icons
echo "Generating links for full-color icons..."
# contexts for loop
for CONTEXT in "${CONTEXTS[@]}"
do
echo " -- "${CONTEXT}
# Sizes Loop
for SIZE in "${SIZES[@]}"
do
LIST="$DIR/fullcolor/$CONTEXT.list"
# Check if directory exists
if [ -d "$DIR/../../$THEME/$SIZE/$CONTEXT" ]; then
echo " -- linking "$SIZE"/"$CONTEXT
cd $DIR/../../$THEME/$SIZE/$CONTEXT
while read line;
do
ln -sf $line
done < $LIST
cd $DIR/../../$THEME
else
echo " ** skipping "$SIZE"/"$CONTEXT
fi
done
done
echo "Done."
# Symbolic icons
echo "Generating links for symbolic icons..."
# contexts for loop
for CONTEXT in "${CONTEXTS[@]}"
do
echo " -- "${CONTEXT}
LIST="$DIR/scalable/$CONTEXT.list"
# Check if directory exists
if [ -d "$DIR/../../$THEME/$SIZE/$CONTEXT" ]; then
echo " -- linking "$SIZE"/"$CONTEXT
cd $DIR/../../$THEME/$SIZE/$CONTEXT
while read line;
do
ln -sf $line
done < $LIST
cd $DIR/../../$THEME
else
echo " ** skipping "$SIZE"/"$CONTEXT
fi
done
echo "Done."
# # HiDPI
# for SCALE in "${SCALES[@]}"
# do
# for SIZE in "${SIZES[@]}"
# do
# echo " -- Linking HiDPI icons for "$SIZE""$SCALE"..."
# cd $DIR/../../$THEME/
# ln -fs $SIZE $SIZE$SCALE
# done
# done
# echo $DIR
# Clear symlink errors
if command -v symlinks 2>&1 >/dev/null; then
echo "Deleting broken links..."
symlinks -cdr $DIR/../../$THEME > /dev/null
echo "Done."
fi