Skip to content

New layouts, dead keys and consumer control helper (fix)

Compare
Choose a tag to compare
@Neradoc Neradoc released this 07 Sep 17:48
· 58 commits to main since this release

This is a major update with breaking changes. Layouts from this update use a different class name and the keyboard_layout common base module is not compatible with past releases.

A big thank to all those who requested and tested keyboard layouts on the Adafruit discord, this repository, or the pico-ducky repository.

New Languages

A list of new languages have been added to the repository. These languages were requested and at least superficially tested by users.

  • Brazil, Czech (2 layouts), Danish, Hungarian, Italian, Portuguese, Swedish, Turkish.
  • Modified FR and DE (renamed)

Keyboard Layouts

  • The keyboard_layouts module now uses a KeyboardLayoutBase class. (Not compatible with previous versions).
  • Dead key combinations generate two presses: layout.write("ô") presses ^ then o (if relevant).
  • COMBINED_KEYS is a table where each combined character is associated with two bytes
    • The first byte is the first (dead) key's keycode, with the shift bit set is needed.
    • The second byte is the character for the second key (not its keycode), a low-ascii character.
    • The high bit of the second byte is set is the first key requires altgr.
    • The second key is assumed to not need altgr (it's space or a-z/A-Z).
  • If the layout has a way to have a character as a single key press, it's used rather than the dead key. (eg: ù on FR layout)
  • All layouts declare a KeyboardLayout class instead of a class based on the language.
    • Only the module name changes between languages
    • This makes it easier than having to "guess" the class name (even if based on the file name).
    • Importing multiple layouts is possible by namespace (keyboard_layout_win_fr.KeyboardLayout) or "import as".

Consumer Control Helper

The consumer_control_extended module brings a big list of names for the consumer controls page in the HID specs, to be used with adafruit_hid.consumer_control.

Layout Generator

The layout generator creates a layout and a keycode file from windows layout files, using XML data from https://kbdlayout.info. Examples on how to use it in the test files, in particular make_validated.sh. Documentation will need to be written. In its current form it only handles that specific format of input, and only handles languages based on the latin alphabet.

An online web-generator is available too, it uses PHP to run the generator in python from a URL, and an online version of it is available at: https://www.neradoc.me/layouts/