macOS에서 현재 사용 언어 표시하기

맥을 전체화면에서 쓰면 언어를 전환했을 때 전환된 언어가 어떤 것인지 확인할 수가 없다는 불편함이 있어서 방법을 찾아봤다.

# isHud

현재 언어를 화면에 표시해주는 isHUD 라는 앱이 있는데 2018년 이후로 업뎃이 안되고 있어 쓰기가 좀 깨름찍하다.

# Input Source Pro

Input Source Pro 라는 최신 앱도 있다.

# Hammerspoon

Hammerspoon 은 Lua로 시스템과 상호작용할 수 있게하는 앱이다. 이걸 설치하고 Open Config에서 다음 코드를 붙여넣으면 한글, 영어, 일본어를 전환할 때마다 전환한 언어를 화면에 오버레이로 1초간 표시해준다.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
local inputSource = {
english = "com.apple.keylayout.ABC",
korean = "com.apple.inputmethod.Korean.2SetKorean",
japanese = "com.apple.inputmethod.Kotoeri.RomajiTyping.Japanese"
}

local customStyle = hs.alert.defaultStyle

customStyle.fillColor = { white = 0, alpha = 0.25 }
customStyle.strokeColor = { alpha = 0 }

customStyle.textColor = { white = 0.75, alpha = 0.75 }
customStyle.textSize = 50

customStyle.fadeOutDuration = 1.0

function IM_alert()

local current = hs.keycodes.currentSourceID()
local language = nil


if current == inputSource.korean then
language = ' 🇰🇷 가나다 '
elseif current == inputSource.english then
language = ' 🇺🇸 ABC '
elseif current == inputSource.japanese then
language = ' 🇯🇵 あいう '
else
language = current
end

if hs.keycodes.currentSourceID() == last_alerted_IM_ID then return end

hs.alert.closeSpecific(last_IM_alert_uuid)
last_IM_alert_uuid = hs.alert.show(language, customStyle, 0.3)
last_alerted_IM_ID = hs.keycodes.currentSourceID()
end


hs.keycodes.inputSourceChanged(IM_alert) 
Licensed under CC BY 4.0
Built with Hugo
Theme Stack designed by Jimmy