Debian 及其衍生版修改键盘映射

修改有风险,操作需谨慎

查看当前键盘布局

hung@my-host-name ~$ setxkbmap -print
xkb_keymap {
    xkb_keycodes  { include "evdev+aliases(qwerty)"    };
    xkb_types     { include "complete"    };
    xkb_compat    { include "complete"    };
    xkb_symbols   { include "pc+us+inet(evdev)+group(alt_shift_toggle)"    };
    xkb_geometry  { include "pc(pc105)"    };
};

备份配置文件

hung@my-host-name ~$ cd /usr/share/X11/xkb
hung@my-host-name /usr/share/X11/xkb$ sudo tar -cvf symbols.tar symbols
hung@my-host-name /usr/share/X11/xkb$ cd symbols

Ctrl LeftCaps 调换

hung@my-host-name /usr/share/X11/xkb/symbols$ sudo vim pc

找到行 key <CAPS> { [ Caps_Lock ] }; 修改为 key <CAPS> { [ Control_L ] };
找到行 key <LCTL> { [ Control_L ] }; 修改为 key <LCTL> { [ Caps_Lock ] };

设置 Alt Right 为功能键,设置如下功能

键位附加功能
H左方向键
J下方向键
K上方向键
L右方向键
F上翻页
N下翻页
4、$End
6、^Home

vim us 修改行 key <AE04> { [ 4, dollar ] };key <AE04> { [ 4, dollar ], [ End ] };
依次类推:

key <AE06> {  [   6,  asciicircum ], [ Home ] };
key <AC04> {  [   f,  F   ], [ Prior ]  };
key <AC06> {  [   h,  H   ], [ Left ] };
key <AC07> {  [   j,  J   ], [ Down ] };
key <AC08> {  [   k,  K   ], [ Up ] };
key <AC09> {  [   l,  L   ], [ Right ]  };
key <AB06> {  [   n,  N   ], [ Next ] };

sudo vim altwin 修改行 key <RALT> { type[Group1] = "TWO_LEVEL", symbols[Group1] = [ Alt_R, Meta_R ] };key <RALT> { type[Group1] = "TWO_LEVEL", symbols[Group1] = [ Mode_switch ] };

应用配置

  1. 注销从新登录生效

  2. 执行 sudo dpkg-reconfigure xkb-data

方法二我这里不生效

现在按住 Right Alt 加响应的功能键就可以了执行相应的功能了。

参考

    原文作者:鸿则
    原文地址: https://segmentfault.com/a/1190000011940681
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞