fcitx에는 ’quickphrase’라는 유용한 기능이 있습니다. 이 기능은 자주 사용하는 문구를 빠르게 입력할 수 있게 해줍니다. 저는 그동안 이 기능을 주로 이모지 입력에만 사용해왔습니다. 예를 들어, 제 QuickPhrase.mb 파일은 다음과 같았죠:
제
QuickPhrase.mb:smile 😀 crying 😢 grinning 😀 halo 😇
그러나 최근 fcitx5-lua와 함께 이 기능을 더욱 확장할 수 있다는 것을 알게 되어 공유하고자 합니다.
한 가지 예로, 현재 시각을 입력할 수 있는 기능을 추가해 보았습니다. 이를 위해 $HOME/.local/share/fcitx5/lua/imeapi/extensions/datetime.lua 파일에 다음 내용을 추가합니다:
-- based on https://askubuntu.com/questions/806349/how-to-quick-input-current-date-time-with-a-quick-word
function LookupDate(input)
local fmt
if input == "" then
fmt = "%Y-%m-%d" -- day
elseif input == "t" then
fmt = "%H:%M:%S" -- time
elseif input == "i" then
fmt = "%Y-%m-%dT%H:%M:%S%z" -- iso8601
elseif input == "w" then
fmt = "%G-W%V-%u" -- weekday formats (iso 8601)
elseif input == "u" then
fmt = "%Y-%m-%dT%H:%M:%SZ" -- utc
end
return os.date(fmt)
end
ime.register_command("dt", "LookupDate", "날짜·시간 입력")
fcitx5를 재시작하면 다음과 같이 날짜와 시간을 쉽게 입력할 수 있습니다:
이 외에도 fcitx5-lua를 활용하면 다양한 기능을 추가할 수 있습니다. https://fcitx-im.org/wiki/Lua와 fcitx5-lua를 참고하시면 됩니다. 창의적인 확장 기능을 만들어보세요. :)