Tag Archives: fcitx

Why surrounding text is the worst feature in the Linux input method world

This is mainly a complain about how mess this feature is and why no one could reliably use it. To give people some background, surrounding text is about the feature that an application can notify the input method what are … Continue reading

Posted in fcitx development | Tagged , , , , | Leave a comment

How to use a missing keyboard layout in Fcitx 5

When Fcitx read the layout information, it read from xkeyboard-config, mostly like to be /usr/share/X11/xkb/rules/evdev.xml on your system. But unfortunately, there might be missing data in this file and you should report the bug to bugs.freedesktop.org for missing data. But … Continue reading

Posted in fcitx development | Tagged , , | 1 Comment

Fcitx 5 开发(二)一个按键事件的后半生

当按键被 Fcitx 的前端接收到之后,首先它需要找到对应的输入上下文,然后创建对应的按键事件结构: https://github.com/fcitx/fcitx5/blob/c492be884540b55ee590d0e3312c4889c8bf4300/src/lib/fcitx/event.h#L242 首先对于一个按键来说,我们先要区分和按键相关的好几个不同的值的含义:Code,State,Symbol。Code 表达的是这个按键对应的物理按键,例如键盘上的 A,不论你在什么情况下按 A(Caps Lock / Shift),产生的 Code 是一样的。State,表示了按键发生时键盘的状态,包括了锁定键的状态,比如 Num Lock 和 Caps Lock,还有各种修饰键(Modifier)的状态是否被按下。当然,对于 32 个 Bit 来说,键盘并没有那么多的按键,因此有一些位在 Fcitx 中也被挪作他用,例如 https://github.com/fcitx/fcitx5/blob/c492be884540b55ee590d0e3312c4889c8bf4300/src/lib/fcitx-utils/keysym.h#L51 这个就是新加入的按键是否是重复键的。 Symbol 则是表达了经过键盘布局转换之后得到的符号,一般来说,输入法的逻辑是直接和 Symbol 打交道的,而不关心从 Code 到 Symbol 之间的转换。Fcitx 的 Symbol 对应的数值是采用和 X11 Symbol 一样的值来简化判断,这样在大部分情况下都不需要重新进行映射。 … Continue reading

Posted in fcitx development | Tagged , | Leave a comment

Client Side Input panel for Fcitx 5

(English version is at the end of this post.) 输入框的定位相关的问题其实很复杂,过去 Fcitx 总是自己绘制相关的窗口。X11 这个办法还好使,但是其他情况可能就没这么好使了。让客户端绘制窗口的想法其实比 Fcitx 5 要早得多,最早是为了 fbterm 而增加的支持。 显然 fbterm 没法利用任何来自显示管理器的界面,所以它需要自己绘制它自己的界面。那会儿我添加了一个很简单的实现来支持这个功能。 为了正确显示界面需要支持以下功能: 窗口显示在光标的位置 窗口不能移出屏幕 在 wayland 里,和 X 最大的区别就是不知道窗口的位置,所以不得不使用特别的方法来支持。 用 wayland 的输入法协议的话,它确实是支持将某个窗口标记为输入法窗口并让混成器帮你进行定位,但是需要程序自己先使用 wayland 的输入法协议,混成器也要支持这个协议。目前这两部分的支持并不好。 或者让窗口传送一个相对坐标,然后让混成器帮忙移动窗口。gnome wayland + kimpanel 的扩展就是这样进行定位的,因为 kimpanel … Continue reading

Posted in fcitx development | Tagged , , , | 3 Comments

如何现在就用上 Fcitx 5 (Flatpak)

折腾了很久的自动构建,现在终于可以拿出来给大家用一下了。当然,据说 flathub 有特色网络问题……这部分我就不负责解决了。 首先添加源: 安装 Fcitx 5 和输入法: 然后,在本地非 flatpak 程序上使用的话,还需要安装 fcitx 4/5 的 im module。这个 repo 除了提供另一种更新方式之外,也主要是为了方便还没提供 fcitx 5 的发行版测试。fcitx 4 只要是最近的版本,都可以直接和 fcitx 5 配合使用。环境变量方面当然还是和过去一样,比较传统的就是设置在 ~/.xprofile 里面(和过去一样,如果你已经对 fcitx 4 进行设置了就不用修改什么。) 自动启动就把 flatpak 的 fcitx 5 的 desktop file 加入到自动启动即可。但相对的也需要阻止 … Continue reading

Posted in fcitx development | Tagged , , | Leave a comment