-
Notifications
You must be signed in to change notification settings - Fork 9
Open
Description
Thank you for developing.
I updated from Fcitx to Fcitx5 a few days ago.
Currently used with mozc. It works very well.
I have some questions and requests.
Background
I have developed Addon for Fcitx(Fcitx4).
https://github.com/hankei6km/fcitx-at-esc
This addon doesn't work with Fcitx5, so I want to develop a new addon with Lua.
The main features of addon that are planned are as follows.
Execute the following when ESC is pressed.
Commit the text in the pre-editing to context
==> Deactivate IME
==> Pass through ESC (to Vim etc.)
I wrote the following code, but couldn't get the preedit status.
local fcitx = require("fcitx")
function deactivateInputMethod()
os.execute("sh -c 'dbus-send --session --print-reply --dest=org.fcitx.Fcitx5 /controller org.fcitx.Fcitx.Controller1.Deactivate >/dev/null &'")
end
local forceDeactivate = false
local confForceDeactivate = false
local confCommitPreedit = false
fcitx.watchEvent(fcitx.EventType.KeyEvent, "keyEventHandler")
function keyEventHandler(sym, state, release)
if (sym == 65307 and state == 0) and not release then
if preedit then
if confCommitPreedit then
-- fcitx.commitPreedit()
end
if confForceDeactivate then
-- fcitx.deactivateInputMethod()
deactivateInputMethod()
end
else
-- fcitx.deactivateInputMethod()
deactivateInputMethod()
end
end
return false
endQuestion
- Is there a way to get the preedit status and text from Lua addon?
- Is there a way to commit the pre-edit text from Lua addon?
Feature request
It would be helpful if the following features were implemented.
- preedit flag in KeyEvent haandler
- fcitx.commitPreedit()
- fcitx.deactivateInputMethod()
fcitx.watchEvent(fcitx.EventType.KeyEvent, "keyEventHandler")
function keyEventHandler(sym, state, release, preedit)
if (sym == 65307 and state == 0) and not release then
if preedit then
if confCommitPreedit then
fcitx.commitPreedit()
end
if confForceDeactivate then
fcitx.deactivateInputMethod()
end
-- snip
end
or
- text argument in UpdatePreedit event handler
local curPreeditText = ""
fcitx.watchEvent(fcitx.EventType.UpdatePreedit, "updatePreeditHandler")
function updatePreeditHandler(text)
-- print(text)
curPreeditText = text
end
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels