맥에서 흑백화면 전환을 쉽게

By | 2018-11-29

엊그제 페북의 백투더맥 그룹에서 우연히 읽은 다크모드에 관한 게시물.
https://www.facebook.com/groups/backtothemac/permalink/2223484427890450/
시스템환경설정에서 따라해보니 눈도 편안하고 괜찮다. 스레드를 따라가보니 오토메이터로 자동화가 가능한듯 싶다. 검색해서 찾은 방법이 있어 따라해보니 잘 된다. 나중을 위해 정리해둔다.
OS : MacOS 모하비 (ver. 10.14.1)
오토메이터 실행 → 새로운 도큐멘트 → 도큐멘트 유형 : 응용프로그램
동작에서 “AppleScript 실행”을 검색하여 추가.
(* Your script goes here *) 라고 나온 부분에 아래 코드를 입력한다. 원래 코드는 Applescript Mojave Toggle Accessibility Grayscale On/Off 에서 가져왔고 현지언어를 사용할 경우 그에 맞게 문자열을 변경하라는 글에 따라 아래처럼 바꾸었다.

tell application "System Preferences"
	reveal anchor "Seeing_Display" of pane id "com.apple.preference.universalaccess"
end tell
tell application "System Events" to tell process "System Preferences"
	repeat while not (exists of checkbox "흑백음영 사용" of group 1 of window "손쉬운 사용")
		delay 0.1
	end repeat
	set theCheckbox to checkbox "흑백음영 사용" of group 1 of window "손쉬운 사용"
	tell theCheckbox
		# If the checkbox is not checked, check it to turn grayscale on
		if not (its value as boolean) then
			set checked to true
			click theCheckbox
		else # else turn grayscale off
			set checked to false
			click theCheckbox
		end if
	end tell
end tell
tell application "System Preferences"
	quit
end tell

적당한 이름 GrayScale.app 등으로 이름 저장한 후 실행하면 보조접근에 대한 안내창이 뜨면 시스템환경설정 → 보안 및 개인정보보호 → 손쉬운 사용에서 GrayScale.app 을 선택해주면 된다.
Better Touch Tool을 쓰고 있는지라 ⌥⌘G 키에 GrayScale.app 실행을 매칭해두어 필요시에 즉시 바꿀 수 있도록 해 두었지만 Spotlight로 실행해도 충분할 것 같다.