Linux 快捷键修改 xmodmap | Control 键与 Caps_Lock 互换


发布评论 (0)

普通键盘上的 Control 键离的太远无法满足一些常用快捷键的需求,我们需要将Control键调整至方便位置。 主要是将 Control 键调整至 Caps_Lock 键的位置。同时将 LAlt 键也调整为 Control (当做Cmd键使用)LSuper (WIndows键)调整为 LAlt 。最终目标是与Mac键盘对应, 并将Control键移至Caps_Lock。

最终映射关系: LCaps_Lock => LControl LAlt => LControl LSuper => LAlt LControl => LCaps_Lock

Ubuntu / Debian

修改文件(没有该文件则新增)
sudo vim ~/.Xmodmap
添加内容
remove control = Control_L
remove lock = Caps_Lock
! Caps_lock to LControl
keysym Caps_Lock = Control_L
remove mod1 = Alt_L
remove mod4 = Super_L
! LAlt to LControl
keysym Alt_L = Control_L
! LSuper to LAlt
keysym Super_L = Alt_L
! LControl to LCaps_lock
keysym Control_L = Caps_Lock
add control = Control_L
add mod1 = Alt_L
add lock = Caps_Lock
add mod4 = Super_L
将Xmodmap 添加至 .profile
sudo vim ~/.profile

# 添加内容
sleep 4 && xmodmap ~/.Xmodmap &
重新启动或执行 source ~/.profile 立即生效  

OS X

在设置菜单 - 键盘 - 快捷键设定 中可以直接修改对应快捷键  

Windows

使用 AutoHotKey 添加如下脚本
; IMPORTANT INFO ABOUT GETTING STARTED: Lines that start with a
; semicolon, such as this one, are comments.  They are not executed.

; This script has a special filename and path because it is automatically
; launched when you run the program directly.  Also, any text file whose
; name ends in .ahk is associated with the program, which means that it
; can be launched simply by double-clicking it.  You can have as many .ahk
; files as you want, located in any folder.  You can also run more than
; one ahk file simultaneously and each will get its own tray icon.

; SAMPLE HOTKEYS: Below are two sample hotkeys.  The first is Win+Z and it
; launches a web site in the default browser.  The second is Control+Alt+N
; and it launches a new Notepad window (or activates an existing one).  To
; try out these hotkeys, run AutoHotkey again, which will load this file.

; Note: From now on whenever you run AutoHotkey directly, this script
; will be loaded.  So feel free to customize it to suit your needs.

; Please read the QUICK-START TUTORIAL near the top of the help file.
; It explains how to perform common automation tasks such as sending
; keystrokes and mouse clicks.  It also explains more about hotkeys.

;#####   BEGIN   #####

;#### ALT + TAB TO CTRL + TAB
*tab::
{   

    if(GetKeyState("LAlt", "P")){   
        Send {LControl up}{Alt down}{tab}
        KeyWait, tab  
    } else if(GetKeyState("LShift", "P")){
        Send {LShift down}{tab}
        KeyWait, tab 
    }else{   
        send {tab}
    }      
    return
}     
~LAlt Up::
{   
    send {lalt up}
    return
}

;#### LALT TO LCTRL LWIN TO LALT LALT TO LWIN (CONTROL)
LAlt::LCtrl 
LWin::LAlt 
LCtrl::LWin 
Capslock::LCtrl
 

本文发布于: 2016-05-05 10:27:40,作者: Zack Lee。 属于: Linux, OS 分类,被贴了 CapsLock, Control 标签。


> 评论区域

评论系统维护中

还没有人参与评论