www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

gui-wrapper-mac.sh (959B)


      1 #!/bin/sh
      2 
      3 set -e
      4 
      5 resolution="$1" # e.g. 800x600x24 (width x height x bits_per_pixel)
      6 shift           # the following arguments are the program to execute and its arguments
      7 
      8 bg="$(./utils/absolute-path.sh "build/checkerboard_$(echo "$resolution" | cut -d 'x' -f1-2).png")"
      9 anim="$(./utils/mktemp.sh -d)"
     10 
     11 echo "$anim $resolution $@"
     12 sleep 2
     13    osascript -e "tell application \"Finder\" to set desktop picture to (POSIX file \"$bg\")" \
     14 || osascript -e "tell application \"System Events\" to tell every desktop to set picture to \"$bg\""
     15 sleep 1
     16 ./utils/screenshots-loop.sh mac "$anim" &
     17 "$@"
     18 
     19 touch "$anim/stop-screenshots"
     20 anim_done=false
     21 for i in `seq 300`; do if test -e "$anim/anim-done"; then anim_done=true; break; fi; sleep 1; done
     22 if $anim_done; then echo "anim: done ($*)"; else echo "anim: timeout ($*)"; fi
     23 if test -e "$anim/anim.gif"; then
     24   mv "$anim/anim.gif" "./deploy-screenshots/$(basename "$1" .sh)-anim.gif"
     25 fi
     26 
     27 # Cleanup
     28 rm -r -- "$anim"