自分専用ダッシュボードをMacで自動レイアウトする方法(AppleScript活用)
毎朝PCを立ち上げると、Gmail・Googleカレンダー・スプレッドシートなど「必ず開くページ」を手動で並べ直していませんか?
実現したいこと
-
Mac起動後にワンクリックで、必要なページを Chrome で開く
-
外部モニターの解像度(例: 3440x1440)に合わせて 4分割レイアウト
-
毎朝同じ位置に Gmail・カレンダー・スプレッドシートを配置
スクリーンショット例:
-
左上:Googleカレンダー(週表示)
-
右上:Googleカレンダー(日表示)
-
左下:Gmail
-
右下:Googleスプレッドシート
AppleScript コード例
以下を スクリプトエディタ
に貼り付け、「アプリケーション形式」で保存します。Dock に置けばワンクリックで起動できます。
tell application "Google Chrome"
-- 左上(Googleカレンダー:週表示)
set win1 to make new window
set URL of active tab of win1 to "https://calendar.google.com/calendar/u/0/r/week"
set bounds of win1 to {0, 0, 1720, 720}
-- 右上(Googleカレンダー:日表示)
set win2 to make new window
set URL of active tab of win2 to "https://calendar.google.com/calendar/u/0/r/day"
set bounds of win2 to {1720, 0, 3440, 720}
-- 右下(スプレッドシート)
set win3 to make new window
set URL of active tab of win3 to "https://docs.google.com/spreadsheets/d/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/edit"
set bounds of win3 to {1720, 720, 3440, 1440}
-- 左下(Gmail)
set win4 to make new window
set URL of active tab of win4 to "https://mail.google.com/mail/u/0/#inbox"
set bounds of win4 to {0, 720, 1720, 1440}
end tell
仕組みのポイント
-
set bounds of winX to {左, 上, 右, 下}
でウィンドウの座標をピクセル指定できます。 -
3440x1440 を半分に分けて、それぞれ 1720x720 の4領域に分割。
-
URL部分を自分の「毎朝開きたいページ」に置き換えれば、自分専用ダッシュボードが完成します。
応用
-
2分割や3分割レイアウトも自由に設定可能。
-
Automator
やショートカット.app
と組み合わせれば、Mac起動時に自動起動も可能。 -
Chrome以外のアプリ(SafariやFinder)も同様に位置指定できます。
まとめ
毎朝の「ウィンドウ並べ直し作業」を AppleScript で完全自動化できました。
わずか数十行のスクリプトで、外部モニターを自分専用のダッシュボードに変えられます。
👉 ルーチンワークを減らして、自分の時間を増やしたい人におすすめです!