linux 下把Caps_Lock 映射成Ctrl

我用的是debian 7,以前是gnome桌面,系统里就有改变键盘布局的设置。之前gnome 崩了一次,就换成了openbox ,稍微配置了一下也可以很好使用。

可以参考这篇文章

         5分钟openbox

但没在系统里找到修改键盘布局的,于是在网上搜相关的博客

         交换ctrl和caps lock

里面.xmodmap文件内容是这样

 

remove Lock = Caps_Lock
remove Control = Control_L
keysym Control_L = Caps_Lock
keysym Caps_Lock = Control_L
add Lock = Caps_Lock
add Control = Control_L


将左ctrl ,caps lock交换了,在使用中我发现caps lock的使用率极低,而且这样互换后很容易不小心按到左ctrl导致错误切换大小写的问题。

 


所以我尝试改了下

 

remove Lock = Caps_Lock
remove Control = Control_R
keysym Control_R = Caps_Lock
keysym Caps_Lock = Control_R
add Lock = Caps_Lock
add Control = Control_R


这样,caps lock 和ctrl就都是ctrl的功能。执行下

xmodmap ~/.xmodmap  2>/dev/null

运行下xmodmap 可以看到和改之前没变化

 

 

shift       Shift_L (0x32),  Shift_R (0x3e)
lock        Caps_Lock(0x42)
control     Control_L (0x25),  Control_R (0x69)
mod1        Alt_L (0x40),  Alt_R (0x6c),  Meta_L (0xcd)
mod2        Num_Lock (0x4d)
mod3      
mod4        Super_L (0x85),  Super_R (0x86),  Super_L (0xce),  Hyper_L (0xcf)
mod5        ISO_Level3_Shift (0x5c),  Mode_switch (0xcb)


可以每次开机都运行一下命令,也可以想上文那里一样写道.bashrc或者其他的配置文件

 

我用的是openbox 桌面,它有一个autostart 文件,我写到了这里面

 

#
# These things are run when an Openbox X Session is started.
# You may place a similar script in $HOME/.config/openbox/autostart
# to run user-specific things.
#

# If you want to use GNOME config tools...
#
#if test -x /usr/lib/openbox/gnome-settings-daemon >/dev/null; then
#  /usr/lib/openbox/gnome-settings-daemon &
#elif which gnome-settings-daemon >/dev/null; then
#  gnome-settings-daemon &
#fi

# If you want to use XFCE config tools...
#
#xfce-mcs-manager &
tint2&
xmodmap ~/.xmodmap 2>/dev/null


 



 


 

你可能感兴趣的:(linux)