There are three keys on a HHKB for Delete and Backspace:

  • Delete
  • BS, by pressing Fn + Delete
  • Del, by pressing Fn + `(Backtick)

Getting the keycodes using ‚xev‘

Depending on the settings of the HHKB (the DIP-switches on the back of the keyboard), they produce different keycodes:

HHKB and Win-ModeHHKB and Win-Mode, Delete-key=’BS‘Mac-Mode
Delete119 (Delete)22 (Backspace)22
BS22 (Backspace)2277 (NumLock)

The keycodes were determined using a HHKB Professional Classic, but I assume that other HHKBs will give the same results.

Setting BS as Delete

Which keycode does not fit? The 77 for BS in Mac-Mode does not make any sense. And the Mac-mode is the most useful under Linux, because this is the only way to use the volume keys.

Luckily it’s easy in Linux to redefine these codes in Linux (if you are using X-windows, will not work for Wayland).

Just create a file .Xmodmap in your home directory:

! HHKB in Mac-Mode: Set Fn+Delete as Delete
keycode 77 = Delete NoSymbol Delete

With the next restart of X, or with the command xmodmap ~/.Xmodmap, the key is redefined, and Fn + Delete will work as Delete.

If Fn + Delete should work as Backspace, the line in .Xmodmap would be

keycode 77 = BackSpace BackSpace BackSpace BackSpace