Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100755 79 lines (69 sloc) 2.828 kB
6420fdd @frostrubin added montage applications script
authored
1 #!/bin/bash
2 # This code loops over all .app Applications that reside in the folders defined in the "folders" array (below).
3 # The Icons are copied into a new folder, converted to png and
4 # if imagemagick is present, a tile of all applications is created.
5
6 # After the initial run, the "icns" folder and the "png" folder can be deleted.
7 # Empty the "folders" array in the coding and in the "smallpng" folder, only reatain
8 # icons that you like. The result:
9 # A nice tile of icons! I am using it for my Applications Stack in the Dock.
10
11
12 #The Slash at the end of folder names is important!!
13 folders=( "/Applications/" "/Applications/Utilities/" "/pub/Applications/" "/Developer/Applications/"
14 "/Developer/Applications/Audio/" "/Developer/Applications/Graphics\ Tools/"
15 "/Developer/Applications/Performance\ Tools/" "/Developer/Applications/Utilities/" )
16
17 iconfolder="/Users/bernhard/Desktop/AppIconFolder/"
18 SAVEIFS=$IFS
19 IFS=$(echo -en "\n\b")
20 for folder in ${folders[@]}; do
21 mkdir -p ${iconfolder}icns
22 mkdir -p ${iconfolder}png
23 mkdir -p ${iconfolder}smallpng
24
25 for i in $(ls "$folder"|grep ".app");do
26 echo "$i"
27 plistfile=`cat ${folder}${i}/Contents/Info.plist`
28 iconname=`echo "$plistfile"|grep -A 1 "CFBundleIconFile" | \
29 sed -n '/<string>/,/<\/string>/p;'| \
30 sed 's/<string>//g;s/<\/string>//g'`
31 iconname=`echo ${iconname//[[:space:]]}`
32 iconname=`echo ${iconname}|sed 's/.icns//g'`
33 iconfile=`echo ${iconname}.icns`
34
35 cp "${folder}${i}/Contents/Resources/${iconfile}" \
36 "${iconfolder}icns/${i%.*}.icns"
37 done
38 done
39
40 #cp ${iconfolder}png/* ${iconfolder}smallpng/
41 for i in $(ls "${iconfolder}icns"|grep ".icns");do
42 #convert -resize 128x128 "${iconfolder}smallpng/${i}" \
43 # "${iconfolder}smallpng/${i}"
44 sips -s format png ${iconfolder}icns/${i} \
45 --out ${iconfolder}png/${i%.*}.png
46 sips -i ${iconfolder}png/${i%.*}.png
47 sips -z 128 128 ${iconfolder}png/${i%.*}.png --out ${iconfolder}smallpng/${i%.*}.png /dev/null
48 done
49
50 filecount=`ls -l "${iconfolder}smallpng" | wc -l`
51 filecount=`echo ${filecount//[[:space:]]}`
52 filecount=$(($filecount-1))
53
54 if [ "$filecount" -le 4 ];then
55 tiling="2x2"
56 elif [ "$filecount" -le 9 ];then
57 tiling="3x3"
58 elif [ "$filecount" -le 16 ];then
59 tiling="4x4"
60 elif [ "$filecount" -le 25 ];then
61 tiling="5x5"
62 elif [ "$filecount" -le 36 ];then
63 tiling="6x6"
64 elif [ "$filecount" -le 49 ];then
65 tiling="7x7"
66 elif [ "$filecount" -le 64 ];then
67 tiling="8x8"
68 elif [ "$filecount" -le 81 ];then
69 tiling="9x9"
70 elif [ "$filecount" -le 100 ];then
71 tiling="10x10"
72 else
73 tiling="x1"
74 fi
75
76 montage -geometry +0+0 -tile $tiling -background none \
77 ${iconfolder}smallpng/*.png \
78 ${iconfolder}tile.png
79 IFS=$SAVEIFS
Something went wrong with that request. Please try again.