Using the butterfly key as a modifier

(Peter Myles) #1

For the purposes of typing Welsh, I would like to use the butterfly key to generate vowels with diacritics so that (Butterfly + a) generates the character â etc. I have successfully made some very basic changes to key mapping but this has defeated me so far. Any pointers would be gratefully received.

(Gergely Nagy) #2

The hard part about this is the â generation. There are two major ways this is usually accomplished:

  • You can use a language-specific layout on the OS side, in which case certain symbols turn into others. For example, in HU-QWERTZ, ; becomes é, and to input ;, one must use AltGr + ,. A variant of this is where symbols stay US-QWERTY, but you use AltGr to access language-specific ones.

  • Another way is to use a compose key, which makes it possible to input â by pressing the AltGr ^ a sequence.

To accomplish what you want, you will first need to decide how to input the symbols you need, create a set of Macros, and then you can turn the butterfly key into a ShiftToLayer(WELSH) key, where you map the a key to a macro that inputs â. The macros are sadly non-trivial, because they need to pay attention to shift too.

We started developing plugins that make these things easier, but they’re not all that usable yet. I’m happy to help you create a sketch that allows you to input Welsh, I’ll even write the macros (or plugin, whichever turns out to be easier) for you. I do need to know how you input Welsh symbols on a traditional keyboard, that should be enough to get me started. :slight_smile:

(Peter Myles) #3

Thanks for the reply, Gergely. :slightly_smiling_face:

I usually use an android device for my Welsh lessons where you can hold on a key in the Google keyboard and select an accented character from a popup. On a traditional keyboard I use Alt + numeric pad to enter accented characters so I know the ANSI codes, What I am getting stuck over is how to represent these in the code.

(Gergely Nagy) #4

With a macro, that does the Alt+Numpad magic under the hood. Something along these lines:

enum {

const macro_t *macroAction(uint8_t macro_index, uint8_t key_state) {
  switch(macro_index) {
    return MACRO(D(RightAlt), T(Keypad_0), ..., U(RightAlt));
  return MACRO_NONE;

Repeat for every symbol you wish to enter, and done. Pretty much.

(Peter Myles) #5

Perfect! Exactly what I needed. Many thanks :slight_smile: