add another function FcitxCurrentIMwithRime to show RIME info too

see https://github.com/lilydjwg/fcitx.vim/issues/33#issuecomment-2002346047
This commit is contained in:
lilydjwg 2024-04-21 16:21:34 +08:00
parent 451d277bbd
commit 28d5bcc86d
2 changed files with 14 additions and 0 deletions

View file

@ -26,6 +26,13 @@ class FcitxComm:
else:
return im
def current_and_rime(self):
im = self.fcitx.CurrentInputMethod()
if im == 'rime':
return 'rime:' + self._get_rime().GetCurrentSchema()
else:
return im
def _get_rime(self):
if self._rime is None:
obj = self.bus.get_object('org.fcitx.Fcitx5', '/rime')
@ -90,3 +97,7 @@ def fcitx2zh():
@may_reconnect
def fcitx_current_im():
return Fcitx.current()
@may_reconnect
def fcitx_current_im_and_rime():
return Fcitx.current_and_rime()

View file

@ -51,6 +51,9 @@ elseif has('python3')
function FcitxCurrentIM()
return py3eval('fcitx_current_im()')
endfunction
function FcitxCurrentIMwithRime()
return py3eval('fcitx_current_im_and_rime()')
endfunction
let g:loaded_fcitx = 1
endif