Ubuntu18.04修改iBus输入法快捷键

本文介绍了如何在Ubuntu系统下修改键盘快捷键,将切换中英文的功能从左Shift改为右Shift,同时将切换拼音模式设置为左Control。通过编辑桌面上的ibus-table-engine文件,然后重启iBus服务来实现这些更改。这将帮助减少误操作,提高工作效率。
摘要由CSDN通过智能技术生成

Ubuntu系统中默认使用左Shift切换中英文,由于平时经常使用Shift进行选择操作,经常误切换。

计划作如下修改:

切换中英文:左Shift→右Shift

切换拼音:右Shift→左Control

Ctrl+Alt+T 打开终端,输入以下命令。

xyx@laptop:~$ cd /usr/share/ibus-table/engine/
xyx@laptop:/usr/share/ibus-table/engine$ sudo gedit table.py

修改其中的关键代码。

 

1、切换中英文(使用右 Shift 键

 def _process_key_event (self, key):

        '''Internal method to process key event'''

        # Match mode switch hotkey

        if (self._editor.is_empty()

            and (self._match_hotkey(

                key, IBus.KEY_Shift_R,

                IBus.ModifierType.SHIFT_MASK))):

            self.set_input_mode(int(not self._input_mode))

            return True

2、切换拼音(使用左 Control

 # Change pinyin mode

        # (change only if the editor is empty. When the editor

        # is not empty, the right shift key should commit to preëdit

        # and not change the pinyin mode).

        if (self._ime_py

            and self._editor.is_empty()

            and self._match_hotkey(

                key, IBus.KEY_Control_L,

                IBus.ModifierType.CONTROL_MASK)):

            self.set_pinyin_mode(not self._editor._py_mode)

            return True

        # process commit to preedit

        if (self._match_hotkey(

                key, IBus.KEY_Shift_L,

                IBus.ModifierType.SHIFT_MASK)

            or self._match_hotkey(

                key, IBus.KEY_Shift_R,

                IBus.ModifierType.SHIFT_MASK)):

            res = self._editor.commit_to_preedit()

            self._update_ui()

            return res

3、修改完保存并关闭文件,然后重启iBus:

ibus-daemon -r &

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

iShare_123

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值