-
-
Save weeble/97e2be422f0b266a13e9e81e3482304c to your computer and use it in GitHub Desktop.
Remapping caps-lock with kmonad
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (defcfg | |
| ;; Of course we want fall-through. What would be the point of not having fall-through. | |
| fallthrough true | |
| ;; JESUS CHRIST no. We are not having the keyboard directly executing commands. | |
| allow-cmd false | |
| ;; This is the keyboard we're reading from... | |
| input (device-file "/dev/input/by-id/usb-Apple_Inc._Apple_Internal_Keyboard___Trackpad_D3H5141GLZ1GHJGA71KF-if01-event-kbd") | |
| ;; And this is the virtual keyboard we're writing to. Name doesn't really matter. | |
| output (uinput-sink "My KMonad output") | |
| ) | |
| (defsrc | |
| ;; The keyboard before modification. Some keys (function keys, cursors, bspc) generate | |
| ;; different keycodes when fn is held, they're positioned close to the key. I think we | |
| ;; can actually turn off the special behaviour of the fn-key and take control of it | |
| ;; ourselves, using /sys/module/hid_apple/parameters/fnmode but let's worry about that | |
| ;; another day. | |
| brdn brup scale dashboard bldn blup prev playpause next mute vold volu | |
| esc f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12 power | |
| ` 1 2 3 4 5 6 7 8 9 0 - = bspc del | |
| tab q w e r t y u i o p [ ] | |
| caps a s d f g h j k l ; ' \ ret | |
| lsft 102d z x c v b n m , . / rsft | |
| fn lctl lmet lalt spc rmet ralt left down up right | |
| home pgdn pgup end | |
| ) | |
| (defalias | |
| ;; Caps-escape acts as escape if tapped for <200ms, otherwise as a modifier to access the "holdcesc" layer. | |
| cesc (tap-hold 200 esc (layer-toggle holdcesc)) | |
| ) | |
| ;; Default key behaviours. | |
| (deflayer default | |
| brdn brup scale dashboard bldn blup prev playpause next mute vold volu | |
| esc f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12 power | |
| ` 1 2 3 4 5 6 7 8 9 0 - = bspc del | |
| tab q w e r t y u i o p [ ] | |
| @cesc a s d f g h j k l ; ' \ ret | |
| lsft 102d z x c v b n m , . / rsft | |
| fn lctl lmet lalt spc rmet ralt left down up right | |
| home pgdn pgup end | |
| ) | |
| ;; Key behaviours when caps-escape is held. Underscores fall-through to the default layer. | |
| (deflayer holdcesc | |
| _ _ _ _ _ _ _ _ _ _ _ _ | |
| _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
| esc _ _ _ _ _ _ _ _ _ _ _ _ del _ | |
| caps _ _ _ _ _ _ _ ins _ prnt _ _ | |
| _ _ _ _ _ _ left down up right _ _ _ _ | |
| _ _ C-z C-x C-c C-v _ _ _ _ _ _ _ | |
| _ _ _ _ _ _ _ _ _ _ _ | |
| _ _ _ _ | |
| ) |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I put this at
/etc/kmonad/macbookpro.kbdand didThis works because the Arch package has created
/usr/lib/systemd/system/kmonad\@.servicewith this definition:The
%Emeans/etcand the%imeans "whatever you put afterkmonad@when invokingsystemctl.