AppleScript(シェルスクリプト)でメインディスプレイとセカンドディスプレイのプライマリを変えるまで
普段はI-O DATAのディスプレイをメインに使っていますが,東方などをする際にはmacのディスプレイを使ったほうがやりやすいのでそうしてます.しかし,そのためだけに設定→ディスプレイ→プライマリの変更をするのは面倒臭いですね.そこでAppleScript {ほとんどシェルスクリプト(他人の力)}を使って解決してみました.今回使ったのはこちら
github.com
まず,下のコマンドを実行しメインディスプレイのときと,セカンドディスプレイのときの結果を控えておきます.
fb-rotate -l
あとはこれを実行すればディスプレイのプライマリが交互に入れ替わります.
set infoDis to (do shell script "PATH of fb-routate -l") set theMac to "result of main display" set theExternal to "result of second display" if infoDis is theMac then do shell script " PATH of fb-routate -d <your main display ID> -m" if infoDis is theExternal then do shell script " PATH of fb-rotate -d <your second display ID> -m"