Skip to content

Instantly share code, notes, and snippets.

@csnagu
Created August 15, 2023 00:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save csnagu/0f240727a8b8b9c788d8689ce0b31a23 to your computer and use it in GitHub Desktop.
Save csnagu/0f240727a8b8b9c788d8689ce0b31a23 to your computer and use it in GitHub Desktop.
macでコンテキストに応じたデスクトップレイアウトを準備してくれるAppleScript
tell application "Terminal"
activate
do script "code ~/path/to/workspace"
delay 2
quit
end tell
arrangeWindow(124) -- 124: right arrow
tell application "Google Chrome"
make new window
activate
open location "https://example.com"
end tell
arrangeWindow(126) -- 126: up arrow
delay 2
tell application "Google Chrome"
make new window
activate
open location "https://example.com"
end tell
arrangeWindow(123) -- 123: left arrow
on arrangeWindow(keycode)
tell application "System Events"
key code keycode using {command down, shift down, option down}
end tell
end arrangeWindow
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment