首页 > 代码库 > 交换ctrl和caps_loack的新方法

交换ctrl和caps_loack的新方法

交换ctrl和caps_loack的新方法

Table of Contents

  • 1 过程

1 过程

debian用了几年,由于emacs的关系,一直将右ctrl和caps_lock键交换,使用的是xmodmap 方式,写了.Xmodmap脚本,在.xinitrc中加入:xmodmap ~/.Xmodmap,但最近这个方法无效 了,我只能在.bashrc中执行脚本,但是没开一次终端,脚本都会执行一次,所以再次打开 终端,键位就恢复了。

!! Swap Caps_Rock and Control_R!remove Lock = Caps_Rockremove Control = Control_Rkeysym Control_R = Caps_Rockkeysym Caps_Rock = Control_Radd Lock = Caps_Rockadd Control = Control_R

我将脚本执行放在.xsession,.xsessionrc中都在无法开机时自动执行xmodmap, 最后只有求助于setxkbmap。setxkbmap选项位于这几个文件里: /usr/share/X11/xkb/rules/evdev.lst /usr/share/X11/xkb/rules/base.lst,这俩文件一模 一样……,利用grep搜索过滤"ctrl:或:ctrl"。

$ grep -e "ctrl:\|:ctrl" /usr/share/X11/xkb/rules/evdev.lst grp:ctrls_toggle     Both Ctrl keys togethergrp:ctrl_shift_toggle Ctrl+Shiftgrp:ctrl_alt_toggle  Alt+Ctrlctrl:nocaps          Caps Lock as Ctrlctrl:lctrl_meta      Left Ctrl as Metactrl:swapcaps        Swap Ctrl and Caps Lockctrl:ac_ctrl         At left of ‘A‘ctrl:aa_ctrl         At bottom leftctrl:rctrl_ralt      Right Ctrl as Right Altctrl:menu_rctrl      Menu as Right Ctrlctrl:ctrl_ralt       Right Alt as Right Ctrlcaps:ctrl_modifier   Make Caps Lock an additional Control but keep the Caps_Lock keysymaltwin:ctrl_win      Control is mapped to Win keys (and the usual Ctrl keys)altwin:ctrl_alt_win  Control is mapped to Alt keys, Alt is mapped to Win keysterminate:ctrl_alt_bksp Control + Alt + Backspace 

我选择了ctrl:nocaps,执行dconf-editor, 在org.gnome.desktop.inputsources下面, xkboptions选项,添加如下:[‘ctrl:nocaps],OK.若需立即生效,终端键入 setxkbmap -print即可。

Date: 2014-11-26 12:08:12 CST

Author: 雪庭

Org version 7.8.06 with Emacs version 23

Validate XHTML 1.0

交换ctrl和caps_loack的新方法