0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

BetterTouchToolでSidecarをタッチバーから起動する方法

Last updated at Posted at 2022-01-05

BTTを使ってタッチバーからSidecarを起動するための手引きがなかったので、個人的なメモも兼ねたまとめです。

動作環境

macOS Big Sur 11.6.1(Locale: Japan)
Better Touch Tool 3.3.89

設定項目

タッチバートリガー設定
Select Trigger -> タッチバーボタン

トリガーの割り当て設定
Controlling Other Applications -> Apple Scriptを実行する(ブロック)

スクリプトコードのペイン(以下画像参照)に下記コードを入力

BTTスクリーンショット

スクリプト引用
satokaz. (2021). AppleScript で Sidecar の接続/接続解除をトグルする #17. https://github.com/satokaz/hitorigoto/issues/17.

#Insert_script_code_here
tell application "System Preferences"
	activate
	set the current pane to pane id "com.apple.preference.sidecar"
	get the name of every anchor of pane id "com.apple.preference.sidecar"
	delay 1
	tell application "System Events"
		set target_button to a reference to (first button whose name is "接続解除") of (window "Sidecar" of application process "システム環境設定")
		if target_button exists then
			click target_button
		else
			click menu button "デバイスを選択" of window "Sidecar" of application process "システム環境設定"
			count menu items of menu of menu button "デバイスを選択" of window "Sidecar" of application process "システム環境設定"
			select item 1 of menu button "デバイスを選択" of window "Sidecar" of application process "システム環境設定"
			key code 125
			key code 76
		end if
	end tell
	quit
end tell

その他

satokaz(2021)でも触れられている通り、上記のAppleScriptはJP-Locale用なので、EN-Localeを設定されている方は、rauls4. (2020). Toggle-Sidecar-Automator-Action. https://github.com/rauls4/Toggle-Sidecar-Automator-Workflow. のコードを参照のこと。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?