function IM_alert()
local inputSource = {
english = "com.apple.keylayout.ABC",
korean = "com.apple.inputmethod.Korean.2SetKorean",
}
local current = hs.keycodes.currentSourceID()
local language = nil
if current == inputSource.korean then
language = ' 🇰🇷 가나다 '
elseif current == inputSource.english then
language = ' 🇺🇸 ABC '
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, 1)
last_alerted_IM_ID = hs.keycodes.currentSourceID()
end
hs.keycodes.inputSourceChanged(IM_alert)
저도 lua 이런걸 몰라서 이거보다 좋은 방법은 모르겠네요
Open Config를 클릭하고 위 내용을 넣어주면 아래처럼 작동합니다
local inputSource = {
english = "com.apple.keylayout.ABC",
korean = "com.apple.inputmethod.Korean.2SetKorean",
}
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 = 0.75
function IM_alert()
local current = hs.keycodes.currentSourceID()
local language = nil
if current == inputSource.korean then
language = ' 🇰🇷 가나다 '
elseif current == inputSource.english then
language = ' 🇺🇸 ABC '
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.1)
last_alerted_IM_ID = hs.keycodes.currentSourceID()
end
hs.keycodes.inputSourceChanged(IM_alert)
혹시 저 같은 분들이 계실까봐 덧붙이면...
open config 눌렀더니 xcode가 열려서 너무나 당황했는데 (일 때문에 간혹 열어보는, 쓸 줄도 모르는 xcode가 설치되어 있는 상태)
내용 넣고 cmd s 한 다음에 해머스푼에서 reload config 했더니 뿅 뜹니다.
저는 simplify 님이 남겨주신 내용 대로 하니 너무 금방 사라지는 것 같아서
14행의 페이드아웃은 0.5로, 33행의 0.1을 0.35로 바꿨습니다.
작성자님과 댓글에 내용 추가해주신 분 감사합니다!