Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

What do you use to do this? On what operating systems?


as the two other sibling posters said, I use karabiner elements when on os/x and xcape+xmodmap on Linux with this in my .xsession

  xcape -e 'Control_L=Escape'
which is run after remapping caps lock to Control_L via xmodmap (just xmodmap -pke to create your xmodmap file, xev to figure out which keycode your caps is, and edit the file after to make that keycode Control_L.

For example my xmodmap file, which also sets up meta/super and other overrides is

  !
  ! Clear the modifiers
  !
  clear    lock
  clear    shift
  clear    control
  clear    mod1
  clear    mod2
  clear    mod3
  clear    mod4
  clear    mod5
  
  ! Remapping
  keycode  37 = F17 NoSymbol F17
  keycode  64 = Alt_L NoSymbol Alt_L
  keycode  66 = Control_L NoSymbol Control_L
  keycode  90 = Multi_key NoSymbol Multi_key
  keycode  91 = Mode_switch NoSymbol Mode_switch
  keycode 105 = Meta_R NoSymbol Meta_R
  keycode 107 = Menu Sys_Req Menu Sys_Req
  keycode 108 = Control_R NoSymbol Control_R
  keycode 127 = Redo Undo Redo Undo
  keycode 134 = Alt_R NoSymbol Alt_R
  keycode 135 = Control_R NoSymbol Control_R
  keycode 164 = Undo Redo Undo
  keycode 166 = Super_L NoSymbol Super_L
  keycode 167 = Control_L NoSymbol Control_L
  
  !
  ! Set the modifiers
  !
  add shift   = Shift_L Shift_R
  add control = Control_L Control_R
  add mod1    = Alt_L Alt_R
  add mod2    = Num_Lock
  add mod3    = Super_L
  add mod4    = Meta_R
  add mod5    = Mode_switch


I use this app on Mac for the exact key mentioned above Caps -> Ctrl/Esc

https://github.com/tekezo/Karabiner-Elements


If you are on Linux, try xcape; on Windows, you can do it with autohotkey.


Remapping CapsLock to Ctrl on Windows is easy with KeyTweak (what I have is 2.3.0 by Travis Krumsick), though I had to select the CapsLock key from the displayed keyboard rather than simply hitting the key. All it appears to be doing is updating the Registry's key mapping values based on the keyboard scan codes. Easily found with a simple search, and it does work on Windows 10 even though it hasn't been updated for 8+ years.

I suspect you'd have to switch to something like Autohotkey for the Esc/Ctrl mapping.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: