]> git.lyx.org Git - lyx.git/blob - development/MacOSX/set_bundle_display_options.sh
Customization: correct some color names.
[lyx.git] / development / MacOSX / set_bundle_display_options.sh
1 # Copied from Lyx-Mac-binary-release.sh
2 # TODO: In order to avoid having two versions,
3 # call this file from Lyx-Mac-binary-release.sh
4
5 FILE=$1
6 LyxName=$2
7 IMAGEPATH=$3
8 X_BOUNDS=$4
9 Y_BOUNDS=$5
10
11 # Creates the structure
12 mkdir -p "${FILE}"
13 touch "${FILE}/${LyxName}.app"
14 touch "${FILE}/Applications"
15
16 # Copy the background and make sure the file is visible
17 # For some reason (OS X cache?), we need to remove the previous
18 # file
19 rm -f "$FILE/background.png"
20 cp "$IMAGEPATH" "$FILE/background.png"
21 xattr -c "$FILE/background.png"
22
23 Y_POSITION=$((Y_BOUNDS - 65))
24 Y_BOUNDS=$((Y_BOUNDS + 20))
25 LYX_X_POSITION=$((X_BOUNDS / 4))
26 LYX_Y_POSITION=$Y_POSITION
27 APP_X_POSITION=$((3 * X_BOUNDS / 4))
28 APP_Y_POSITION=$Y_POSITION
29 WITH_DOCUMENTS=$(test -d "${FILE}/Documents" && echo true || echo false)
30 osascript <<-EOF
31 tell application "Finder"
32     set f to POSIX file ("$FILE" as string) as alias
33     set image to POSIX file ("$IMAGEPATH" as string) as alias
34     tell folder f
35         open
36         tell container window
37             set toolbar visible to false
38             set statusbar visible to false
39             set current view to icon view
40             delay 1 -- sync
41             set the bounds to {20, 50, $X_BOUNDS, $Y_BOUNDS}
42         end tell
43         delay 1 -- sync
44         set icon size of the icon view options of container window to 64
45         set arrangement of the icon view options of container window to not arranged
46         if ${WITH_DOCUMENTS} then
47            set position of item "Documents" to {$LYX_X_POSITION,0}
48         end if
49         set position of item "${LyxName}.app" to {$LYX_X_POSITION,$LYX_Y_POSITION}
50         set position of item "Applications" to {$APP_X_POSITION,$APP_Y_POSITION}
51         set background picture of the icon view options of container window to file "background.png"
52         set the bounds of the container window to {0, 0, $X_BOUNDS, $Y_BOUNDS}
53         update without registering applications
54         delay 5 -- sync
55         close
56     end tell
57     delay 5 -- sync
58 end tell
59 EOF
60
61 # Hide again the background
62 chflags hidden "$FILE/background.png"
63