Skip to content

Instantly share code, notes, and snippets.

@mdagost
Created March 16, 2014 23:38
Show Gist options
  • Select an option

  • Save mdagost/9591478 to your computer and use it in GitHub Desktop.

Select an option

Save mdagost/9591478 to your computer and use it in GitHub Desktop.
Applescript to make a window jiggle back and forth at a configurable amplitude and frequency
#!/bin/bash
#the amount of time in between shakes in seconds
pause=$1
#amplitude is the amount of horizontal diplacement
amp=$2
window_width=800
#calculate the position of the right side of the window
x_pos_2=`expr $window_width + $amp`
while [ 1 ]
do
osascript -e "tell application \"Safari\" to set the bounds of the front window to {0, 22, $window_width, 1024}"
sleep $pause
osascript -e "tell application \"Safari\" to set the bounds of the front window to {$amp, 22, $x_pos_2, 1024}"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment