openSUSE / Customize-IBus

Full customization of appearance, behavior, system tray and input source indicator for IBus. (深度定制 IBus 的外观、行为、系统托盘以及输入指示)
https://extensions.gnome.org/extension/4112/customize-ibus/
GNU General Public License v3.0
66 stars 8 forks source link

我的设计理念 My design concept #6

Open HollowMan6 opened 3 years ago

HollowMan6 commented 3 years ago

作为开源系统Linux在中国普及的第一步,解决中文输入法的问题应该被放在首要的位置。我本人一直是Linux的粉丝,在日常开发中绝大部分是用Linux完成的。偶尔看到这样的言论:https://www.zhihu.com/question/286602824/answer/1148890621 ,我会感到十分的沮丧。为什么?为什么中文输入法成了中国人使用Linux的一个障碍点?为什么?为什么大家都喜欢Windows的输入法?为什么?为什么大家都喜欢在Windows上使用搜狗输入法进行打字?基于这样的事实,我本人十分希望能为Linux中文输入法做一点微薄的贡献,来让中国普通用户不再恐惧Linux,甚至爱上免费开源的Linux。

正好,我本人十分希望能够参加谷歌的编程之夏活动,然后看到了IBus项目正在openSUSE社区寻找学生做为IBus制作自定义皮肤功能。说到皮肤,我立刻联想到了搜狗拼音丰富多彩的皮肤,许多人在攻击Linux输入法时也会提到Linux输入法太单调丑陋。因而我很想挑战这一项目,让GNOME用户能够随心所欲地自定义IBus皮肤。在借助于编写GNOME扩展插件轻松实现了这一任务之后,我便萌生了另外编写一个全套的IBus自定义插件,让不同来源的用户同时找到使用Fcitx、非GNOME桌面使用IBus,以及Windows下使用搜狗输入法的感觉。

在编写过程中,我借鉴了一些 https://github.com/tuberry/ibus-tweaker 的功能,保留了其的自定义候选框方向、自定义字体、自动切换源、以及识别GNOME夜灯模式的功能,同时结合了其它各大输入法所长,独立地编写了这个添加了各种用户可能喜欢的自定义配置的插件。

对于自动切换源,我增加了一个选项,来使用户选择是否记住该程序的输入状态,来在切换窗口时切换输入源。因为有些用户确实希望能够记住上一次该程序的输入状态,但是还有一些用户则会说,自己平时大部分输入工作是使用中文或英文完成的,自己切换到另一个输入模式只是为了临时输入一些字符,每次切换窗口之后我不希望再返回时恢复到刚才的状态,而是我平时用的最多的那种输入状态,那么请不要记住输入状态,好吗?

在托盘标签处,用户可以查看IBus版本号,如果没安装IBus时则会提示。有一些新手Linux用户会表示,IBus和Fcitx傻傻分不清,你的这个插件怎么没用,在最后发现用的是Fcitx。加一个重启/启动IBus按钮还可以协助用户排查各种问题。

用户还可以为托盘处添加各种菜单选项,找回非GNOME桌面使用IBus的托盘图标感觉。同时,配置IBus可以直接在菜单处点了,不用每次麻烦点击GNOME设置里的选项,甚至打开终端运行ibus-setup命令。

KDE下的IBus菜单:

image

指示器部分则是完全根据用户的要求,模仿Fcitx的感觉做的。其实现的功能丰富程度甚至远远多于Fcitx,你可以设定仅切换输入源时指示,或者只在切换到英文时指示,还可以设定指示器的显示动画(不想要也没关系,直接关了就好),以及是否自动隐藏和隐藏时间,其主题自动跟随输入法的候选框。下一个版本中还将添加在指示器上点击鼠标右键时自动隐藏,方便用户看到被遮挡的文字。

主题部分则是此项目的重头戏了,用户可以通过 https://github.com/HollowMan6/IBus-Theme 工具,借助于GNOME Shell丰富的主题生态进行混搭,只需一键即可生成可以用的IBus主题,然后进行导入。用户可以将CSS文件放在任意位置,而不是特定的几个位置。让我们多写一些功能,不要去麻烦用户,否则用户一定就会离开。

而关于背景和拖拽移动输入框,则是目前闭源的搜狗输入法早已实现的功能。全图背景则不再进行叙述,为什么许多普通的在Windows下使用搜狗输入法都对其皮肤的高度定制功能赞不绝口,甚至十分喜爱呢?拖拽移动输入框,可以临时性的看到下面被遮挡的文字,而且普通用户看到一个窗口,像普通的窗口一样,都会想着去拖拽来移动它,不能拖拽移动的窗口是十分反人类的设计。

搜狗输入法在Windows下的表现:

GIF 2021-5-21 16-28-48

而至于背景图片,用户使用CSS自己定制则更是十分的反人类。难道每个中文输入法Linux用户都必须学会如何使用CSS语言,然后才能自己定制吗?Linux的使用门槛并不是计算机专业人士,而是千千万万的使用计算机的普罗大众。

至于添加边框,在边框中使用图片,现在看来实现的样式并不完善,左边顶端的边框不知为何会显示不出来,大概率是GNOME的问题。目前贸然推出这种丑陋的设计必然会遭到用户的唾弃。

image

关于候选栏淡入淡出动画的需求:https://github.com/ibus/ibus/issues/2279

欢迎提意见!与诸君共勉。

HollowMan6 commented 3 years ago

As the first step to popularize Linux in China, the solution to the Chinese Input Method should be put in the first place. I have been a fan of Linux for a long time, and most of my daily development is done with Linux. Occasionally, I saw such a statement: https://www.zhihu.com/question/286602824/answer/1148890621 and I'm very depressed. Why? Why is Chinese Input Method a barrier for Chinese to use Linux? Why? Why does everyone like IME on Windows? Why? Why does everyone like to type on Windows using Sougou IME? Based on this fact, I would really like to make a little contribution to Linux Chinese input method, so that ordinary Chinese users will no longer fear Linux, or even fall in love with free open source Linux.

Just as I am looking forward to participating in Google Summer of Code, I saw IBus project looking for students to make customized pre-edit theme functions for IBus in openSUSE community. When it comes to IME themes, I immediately associate the colorful themes of Sogou Pinyin. Many people mention that Linux input method is too monotonous and ugly when they attack Linux input method. So I'd like to take a challenge to this project so GNOME users can customize IBus themes as they like. After I easily realized this task by writing GNOME extension, I planned to create a full set of IBus custom extension, which allows users with different using habits to find the sense of using fcitx, non GNOME desktop using IBus, and using Sogou Pinyin under Windows.

In the process of coding, I learned some functionality from https://github.com/tuberry/ibus-tweaker , keeps its function of customizing candidate box direction, custom font, automatic switching source, and identifying GNOME night light mode. Meanwhile, I independently writes the functionalities which various users may like, to add more customization in combination with the advantages of other input methods.

For automatic switching, I added an option to enable users to choose whether to remember the input status of the program when switching the window. Because some users really want to remember the input status of the program and return their work from last time, while other users will say that most of their input work is done in Chinese or English, switching to another input mode is just to temporarily input some characters. After switching the window, I don't want to return to the previous state, but the most used input state, so please don't remember the input status, OK?

For the tray tab, you can view the version number of IBus, and give notification if IBus is not installed. Some newbie Linux users will say that they can't distinguish between IBus and fcitx, why your extension won't work? In the end, he is using fcitx. And moreover, add a restart / start IBus can button to help users to troubleshoot problems.

Users can also add various menu options to the tray to find the feeling of IBus on non-GNOME desktop. At the same time, users can click configure IBus directly in the menu, without having to click the settings in GNOME or even open the terminal to run the command "ibus-setup".

IBus menu under KDE:

image

The indicator part is completely based on the user's requirements, imitating the fcitx feeling. The functionalities of the indicator now is far more abundant than fcitx. You can set the indicator to only show when switching input source, or only show when switching to English, and also set the display animation of indicator (it doesn't matter if you don't want it, just set NONE directly), and whether to automatic hide and hiding time. Theme follows the candidate box of IME. The next version will also add right click the mouse button on the indicator to hide, so that users can see the blocked text easily.

The theme section is the highlight of this project, and users can use https://github.com/HollowMan6/IBus-Theme Tools, with the help of GNOME shell rich theme ecology to mix the IBus theme while remaining global theme. Only enter several keys, you can generate the IBus theme that can be used, and then import. Users can place CSS files anywhere, not in several specific locations. Let's write more features for users as a programmer, don't bother users, or users will leave.

The background and drag and drop input box are the functions of closed-source Sougou Pinyin input method which has been realized very early, not to mention the whole-picture background. Why do many ordinary Sougou Pinyin users in Windows praise its highly customized functionality of themes? Drag and drop the input box, you can temporarily see the text blocked below. And when ordinary users see a window, like a common window, they will want to drag to move it, and it is a very stupid not to accept drag and move functionality.

Performance of Sougou Pinyin under Windows:

GIF 2021-5-21 16-28-48

As for background pictures, if users can only use CSS to customize that, it is even more stupid. Does every Chinese input Linux user have to learn how to code CSS before they can customize it? Linux is not an operating system that only belongs to computer professional, but a vast majority of people who use computers can use it.

As for adding borders, using pictures in borders now seems to be incomplete. The top left border is not displayed for some reason maybe caused by GNOME. At present, the introduction of such ugly design will inevitably be rejected by users.

image

About the need to add candidate animation:https://github.com/ibus/ibus/issues/2279

Welcome to give advice! Together with the gentlemen who has the same will with me.

HollowMan6 commented 3 years ago

v45-v50通过禁止在候选词上拖动候选框,规避了拖动候选框时点击候选词拖动,松开后自动选择该候选词的问题。

另外新增了配置在候选框中点击鼠标右键自动打开菜单,或者切换输入法,并且自动上已经输入了的英文字母,不会出现输入丢失的情况。如果是在候选词上点击的右键,并且设定的是切换输入法,则会上当前你选择的候选词。该功能前者模拟了搜狗输入法的逻辑。

对于系统托盘,新增支持隐藏键盘指示图标,并且支持配置鼠标特定按键(左/右键)点击图标直接切换输入法,而不必每次打开菜单之后再进行切换。

目前可以说使用了本插件,经过相关配置后,IBus的输入法用户习惯可以完全和Windows上使用搜狗输入法的保持一致。

对于输入源指示器,现在支持配置在指示器上直接点击鼠标左键来临时性的隐藏指示器,同时支持配置选择在指示器上点击鼠标右键切换输入法或者是进行拖拽移动。

HollowMan6 commented 3 years ago

V45-v50 avoids the problem of automatically selecting the candidate word when dragging the candidate box by forbidding dragging the candidate box when hovering the candidate word.

In addition, a new configuration is added: right click in the candidate box to automatically open the menu, or switch the input method, and automatically input the English letters that have been entered when doing so, so that the input will not be lost. If you right-click on a candidate to switch the input method, the current candidate you select will be inputted. The former function simulates the logic of Sogou input method.

For the system tray, the new version supports hiding the keyboard indicator system tray icon, and support the configuration of mouse specific keys (left / right keys) to click the icon to directly switch the input method, without having to switch by every time only after clicking to open the menu.

At present, it can be said that with this extension, after relevant configuration, IBus's input method user habits can be completely consistent with Sogou input method on Windows.

For the input source indicator, it now supports to configure the temporary hidden indicator by clicking the left mouse button directly on the indicator. At the same time, it supports to click the right mouse button on the indicator to switch the input method or drag and drop.

HollowMan6 commented 3 years ago

v51和v52添加了固定候选栏的功能。此功能不仅仅搜狗输入法提供了,还被一个用户提了要求:

https://github.com/libpinyin/ibus-libpinyin/issues/222

另外我还认为应该提供一个固定候选栏不跟随光标的选项,例如定位在屏幕顶部

用户可以为候选框设定9种方位,并且还可以启用 拖拽移动候选框 从而可以随时移动候选框位置。另外可以选择记忆位置,从而在每次登录时保留上次拖动的位置。

HollowMan6 commented 3 years ago

v51 and v52 add functionality to fix candidate box. This feature is not only realized in Sougou Pinyin, but also a user has asked for it:

libpinyin/ibus-libpinyin#222

In addition, I think we should provide an option to fix the candidate bar not following the cursor, such as positioning at the top of the screen.

Users now can set the candidate box position with 9 options, and can also enable drag to re-position candidate at the same time so that to rearrange the position at any time. In addition you can also set to remember position to keep last position into next login.

HollowMan6 commented 3 years ago

v58-59增加了恢复扩展默认设置的功能,并且支持导出或导入设置备份文件。另外用户可以直接方便地从扩展中打开已经选定的样式表或者图片。另外增加了固定输入法列表顺序的功能,该功能导入自 Fixed IME List,因为此功能确实很实用。更多增加此功能的原因请参考这里: https://github.com/AlynxZhou/gnome-shell-extension-fixed-ime-list#why

HollowMan6 commented 3 years ago

v58-v59 add restoring default settings feature, and supporting to import or export settings backup files. In addition users can now easily open stylesheet and pictures directly from control panel. Moreover I add the feature to fix IME list order. This is imported from Fixed IME List since this feature is really great. More reasons for this feature can be found here: https://github.com/AlynxZhou/gnome-shell-extension-fixed-ime-list#why

HollowMan6 commented 3 years ago

v60: 为指示器增加自定义字体功能来使得用户拥有更多的自定义可能;增加显示或隐藏候选框调页按钮配置来简洁化只使用键盘调页的用户输入界面;优化背景显示功能。 v60 add customize font for indicator to give users more customization. add show or hide candidate box page buttons so that some users who only use keyboard to switch pages will find it clean. Improve on showing background.

HollowMan6 commented 3 years ago

v61增加了候选框上滚动以切换页面或候选词功能。因为fcitx支持候选框滚动切换页面,此功能可以让习惯使用fcitx的用户感到更加亲切。 image 另外增加指示器上滚动来切换输入源,这样可以将指示器左键配置为拖拽移动,使得操作更加统一化。

v61 add scroll on candidates box to switch among pages or candidates. Since fcitx supports scroll on candidates box to switch among pages, this functionality will make users who get used to fcitx to find it familiar.

In addition add scroll on indicator to switch input source. In this way, the left click indicator can be configured to drag and move to reposition, which makes the operation more unified.

HollowMan6 commented 3 years ago

v68 add functionality of changing opacity for both candidate box and indicator, since it's too complicated if user wants to change opacity by changing style sheet, and this feature would make things easier. v68增加了为候选框和指示器更改透明度的功能,因为如果用户想通过更改样式表来更改透明度太复杂了,这个功能会让这一要求变得简单多。

HollowMan6 commented 3 years ago

V69 adds the functionality of automatic hot reloading style sheets. This function is implemented using GIO and will not cause a lot of burden on the system. After adding this feature, it will be very convenient for developers to debug the theme, and it will also be very easy for users to use. There is no need to turn off and then turn on the theme function to take effect as before.

Over the past month, I have been studying the possibilities of adding borders for IBus panel, and finally decided not to add this function, because adding a picture borders is too weird. Of course, if you want to add this function, you can give your design bluprint or provide a sample CSS. At present, adding borders directly is not very nice for me.

In addition, I wanted to add a functionality to change the border radius of the IBus input panel, but because changing the border radius can be easily realized by directly changing the value through CSS, I finally decided not to add it and let the user change CSS directly.

v69增加了对样式表自动进行热重载的功能。该功能使用原生Gio来实现,不会对系统造成很多负担。增加了热重载之后开发者调试主题将会变得十分方便,用户也会易于使用,不需要像以前那样先关闭再开启主题功能来生效了。

这一个月来对于Extension部分一直在研究添加边框,最终现在决定还是不添加这个功能,因为加了图片边框,显得太诡异了,当然如果你们希望增加这个功能,可以给出你们的构想设计图,或者提供一个样例CSS,目前而言直接添加边框并不是很美观。

另外我之前还想增加一个更改IBus输入面板边框圆角半径的功能,但是因为更改圆角边框可以直接通过CSS更改数值就可以轻松实现,所以最终还是决定不增加,让用户直接改CSS就可以了。

HollowMan6 commented 3 years ago

V71 adds functions to reset directly in the UI interface to increase flexibility with the system theme and background.

V71增加了功能,使得可以在图形界面直接重设来更随系统主题和背景,增加灵活性。

HollowMan6 commented 2 years ago

V76 According the feedback from user, support hide input source indicator when using single mode IME. Add a show delay for input source indicator. V76 根据用户反馈,支持使用单模式输入法时隐藏指示器;支持输入源指示器显示时延。