Skip to content

Instantly share code, notes, and snippets.

@cantonic
Forked from allfro/bring_back_windows
Last active August 29, 2015 14:26
Show Gist options
  • Save cantonic/1e5ff3877822296cd972 to your computer and use it in GitHub Desktop.
Save cantonic/1e5ff3877822296cd972 to your computer and use it in GitHub Desktop.
Bring all out of bounds Mac windows back in bounds
on run {input, parameters}
tell application "Finder"
set _bounds to get bounds of window of desktop
end tell
tell application "System Events"
set ids to (unix id of processes whose name is equal to "java")
repeat with _id in ids
tell (first process whose unix id is equal to _id)
repeat with _window from 1 to (count windows)
tell window _window
if (get first item of (get position)) is less than 0 or (get second item of (get position)) is less than 0 then
-- set size to {get third item of _bounds, get fourth item of _bounds}
set position to {get first item of _bounds, get (second item of _bounds) + 22}
end if
end tell
end repeat
end tell
end repeat
end tell
return input
end run
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment