Skip to content

Instantly share code, notes, and snippets.

@jdolitsky
Last active June 15, 2022 08:42
Show Gist options
  • Save jdolitsky/bab4466502c69f9a345d9d7a043e94d0 to your computer and use it in GitHub Desktop.
Save jdolitsky/bab4466502c69f9a345d9d7a043e94d0 to your computer and use it in GitHub Desktop.
Custom Linux KBCT Keymap for mimicking macOS
# Place this file at: /etc/kbct/config.yml
#
# Custom Linux Keymap for mimicking macOS
# - Swap leftmeta for leftctrl
# - Swap rightctrl for leftmeta
# - leftmeta+c mapped to copy
#
- keyboards: [ 'My USB Keyboard', 'My BuiltIn Keyboard' ]
keymap:
leftmeta: leftctrl
rightctrl: leftmeta
layers:
- modifiers: ['leftmeta']
keymap:
c: copy

Notes

  • This remap file is intended for use with kbct. See https://github.com/samvel1024/kbct/
  • Replace "My USB Keyboard" and "My BuiltIn Keyboard" with your devices found using "kbct list-devices"
  • This allows you to use Super+c for copy, and Super+v for paste across all applications (almost)
  • Most applications recognize the "copy" key for copy, but some define their own. For example, in gnome-terminal and cherrytree, you must go into preferences and change the keyboard shortcut for copy to be the "copy" key (which, once kbct is running, you can trigger by pressing Super+c)
  • Some applications, for example chromium, recognize the "copy" key for copying off of webpages, but not copying out of the URL input/search bar (strange)
  • Since leftmeta is remapped to leftctrl, rightctrl is mapped to leftmeta, so you can use rightctrl as the window overview shortcut key
  • In GNOME settings > Keyboard > Keyboard Shortcuts, under "Navigation", you may wish to use Super+Left and Super+Right (now Ctrl+Left and Ctrl+Right) for "Move to workspace on the...". Now you can use Ctrl, Ctrl+Left, Ctrl+Right to move around
  • Since the terminal tty layer does not recognize the Super key, these settings do not apply for things such as Ctrl+c (SIGINT) and Ctrl+r (reverse search). The same applies for Bash shortcuts such as Ctrl+a (beginning of line) and Ctrl+e (end of line). For more info on these limitations, please see https://superuser.com/a/1178565
  • This is not quite perfect, but for macOS terminal users, this feels pretty darn close
# Place this file at: /etc/systemd/system/kbct.service
#
# To run:
# systemctl enable kbct
# systemctl start kbct
#
[Unit]
Description=Keyboard keycode mapping daemon supporting layered configuration
[Service]
Type=simple
ExecStart=kbct remap --config /etc/kbct/config.yml
Restart=always
[Install]
WantedBy=default.target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment