Skip to content

Instantly share code, notes, and snippets.

@jmkim
Last active November 3, 2017 21:07
Show Gist options
  • Save jmkim/3f1eadd4bd33e25f3f525c9e5086a955 to your computer and use it in GitHub Desktop.
Save jmkim/3f1eadd4bd33e25f3f525c9e5086a955 to your computer and use it in GitHub Desktop.
HHKB layout for standard keyboard, using xkb

HHKB layout for standard keyboard, using xkb

Fully working on Ubuntu 16.04 LTS

This symbol will do:

  • Swap Backspace and Backslash
  • Swap CapsLock with Right Ctrl

We need edit to these files:

  • /usr/share/X11/xkb/rules/evdev
  • /usr/share/X11/xkb/rules/evdev.lst

How to do

Download the custom symbol file (which is below this README) and put into /usr/share/X11/xkb/symbols. After then, follow Edit the files.

Edit the files

/usr/share/X11/xkb/rules/evdev

Add to the end of the section ! option = symbols:

  custom:hhkb_layout		=	+custom(hhkb_layout)

/usr/share/X11/xkb/rules/evdev.lst

Add to the end of the file:

  custom:hhkb_layout   Custom layout (Happy Hacking Keyboard)

After then, follow the #4 of this link.

References

// http://askubuntu.com/questions/501659/how-to-swap-command-and-control-keys-with-xkb-step-by-step
// HHKB layout for xkb, written by Jongmin Kim (kdzlvaids@gmail.com)
partial modifier_keys
xkb_symbols "hhkb_layout"
{
// Swap Backspace and Backslash
key <BKSP> { [ backslash, bar ] };
key <BKSL> { [ BackSpace, BackSpace ] };
// Caps Lock to Ctrl
key <LCTL> { [ Control_R ] }; // LCtrl -> RCtrl
key <RCTL> { [ Caps_Lock ] }; // RCtrl -> CapsLock
key <CAPS> { [ Control_L ] }; // CapsLock -> LCtrl
modifier_map Lock { <RCTL> };
modifier_map Control { <LCTL>, <CAPS> };
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment