[已解决]如何在 zenity 对话框弹出之后自动激活 fcitx?

你可以让 fcitx5 对 zenity 默认激活。在 ~/.local/share/fcitx5/lua/imeapi/extensions 创建一个 .lua 文件,写上:

local fcitx = require("fcitx")

local app_im = {
  ['zenity'] = '你想要用的输入法',
}

function onContextCreated()
  local p = fcitx.currentProgram()
  local colon = p:find(':', 1, true)
  if colon then
    p = p:sub(1, colon-1)
  end

  local a = app_im[p]
  if a then
    fcitx.setCurrentInputMethod(a, true)
  end
end

fcitx.watchEvent(fcitx.EventType.ContextCreated, "onContextCreated")

脚本修改自 https://github.com/hosxy/fcitx5-lua-spusim