Skip to content

Instantly share code, notes, and snippets.

@thangtv611
Created November 17, 2025 06:27
Show Gist options
  • Select an option

  • Save thangtv611/3dacc3528599183e76b5ee871b55129d to your computer and use it in GitHub Desktop.

Select an option

Save thangtv611/3dacc3528599183e76b5ee871b55129d to your computer and use it in GitHub Desktop.
Move all windows to built-in desktop without worrying about external's position toward built in
tell application "System Events"
set allApps to every application process whose visible is true
repeat with appProc in allApps
try
repeat with w in (every window of appProc)
try
set {xPos, yPos} to position of w
if xPos < 0 or yPos < 0 then
set position of w to {100, 100}
end if
end try
end repeat
end try
end repeat
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment