Multi layer Keyboard

Good day,

Well, I’ve been thinking… With keyboards like the Code keyboards, the Ergodoxes, Ducky, WASD Code… all offer the chance to program layers according to user needs. Some use proprietary software, some use the QMK opensource, to configure the different layers and so on.

Those with proprietary software can only be configured on Windows, some even on Macs. Those that use QMK can be configured using the QMK website. Being the later the only ones that could be configured on Haiku too.

But… and this is what I’ve been thinking about lately… Any keyboard on Haiku can be a multilayered programmable keyboard, with the only limitation of Macros, AFAIK.

Haiku allows users to create custom layouts, change the location of keys, which potentially leads to infinite layered keyboards (if anyone is capable of managing infinite layers anyway :grin:), and change layouts using the Keymap Switcher preference. Ain’t that cool enough? :wink:

This is a nice feature that seems to be not so well known… though for keyboard freaks (me included) it’s a plus, ain’t it? :crazy_face:


1 Like

Maybe a stupid idea but, you could try to associate a key to a script with shortcuts app to have macro.

It should be completely doable with the Haiku architecture of the input_server and addons. Though something so fundamental might interfere with other input addons in some way and it would probably need to be the very first one, though I don’t know offhand if you can enforce ordering.

It probably would not be hard to code up a prototype to prove the concept, even something as simple as a “layer” which swaps some keys to just prove the point. You would need to pick a little used key to control the layers, and for extra points you could code a Deskbar replicant which is kept in sync with the current layer using BMessages. Maybe you could even talk back to the addon and choose a layer with a menu as well.

Having said all this makes me want to try hacking up a prototype. Maybe sometime soon :smiley:

1 Like

You have just described KeymapSwitcher which already exists and was already mentionned in the initial post :slight_smile:

Associate a script using hey to a shortcut and you have already something powerful.
If you have a dozen of these handy by just switching keymap it will make some jealous on other systems. :smiley:
If there’s no need to reinvent wheel, you need to be very careful picking characters for the special keymap. Swapping keys around won’t be enough as you wouldn’t want to call a script accidentally. You need to find symbols easy to remember and that you will never use for typing. It seems easy for English speaking people but for others it’s quite common to use three different keymaps; this is reducing choices. Perhaps runes could do it?

Good day,

Actually, I never had thought about scripts or ‘hey’. The only thing I know about ‘hey’ is that is the application scripting language on Haiku and “Hey, Mr. Tambourine man, play a song for me…”, but nothing more, nothing deeper.

Now, yes, I’ve mentioned KeymapSwitcher and thought about this “feature” after preparing the Yawerty keymap and the XBows keyboard Layout. Actually, on Haiku one could buy the 5$ tag “El Cheapo Compatto” keyboard and have a fully programmable keyboard right now, multilayered, modifying keymaps and adding custom keymaps as long as the switch key combination in all keymaps (layers) stays the same, I presume. I wouldn’t think about changing the key combination and their location for this. AFAIK, this “feature” is only available on Haiku. Any keyboard is fully programmable, layerable, with the limitation of macros.

Now, what if macros (keyboard shortcuts) could be assigned on per keymap basis? Well, then it would be the supadupa keyboard feature galore. Biased examples could be:

  • Set a keymap for Krita, to trigger different brushes, change brush width, colors, whatever… (I’m thinking about drawing on the digitizer with the other hand on the keyboard tweaking the strokes, etc)
  • Set a keymap for LMMS, to triger tracks, mutes, fx, change track pan…
  • Set a keymap for MuseScore, to add sharps, flats, note duration, clef, accents… (this example, if MIDI-USB worked might need some rethinking)

You get the point, right?

The possibilities are infinite, as the number of layers. Even one could set a Coledvorak keyboard mix if feeling fearless.

The point being, this programmable multilayer feature of keyboards on Haiku seems to be there, a default feature, not so well known, but very powerful indeed. Maybe waiting to be “rediscovered”? And IMHO, many of other features are not so well known too. :thinking:

Right now I’m carrying out some tests on other stuff, thus the “need” to complete the “switch”, to test more and discover more at a speedier pace. Speedier than now, this does not mean fast.

I could think more about ancient Egypt hieroglyphs :rofl: (duck-duck-arm-bread-ibisHead-cowHeart)

@leavengood, maybe, as the KeymapSwitcher is already there, you could think on how to get the macros/shortcuts be active on a per keymap basis? If that is even possible. Then associating scripts/hey to a key as @Starcrasher pointed out, only on selected keymap would be possible without triggering an unwanted macro when not using the proper keymap where that macro is set?

Seems that the biggest “issue” with Haiku is that outside here, I mean, the community, no one knows about its true potential, which I have the feeling is way bigger than one could expect.

Regards, and thanks!


And here is the proof of that it can be done. A NumPad keymap, on the right side of the keyboard for TKL keyboards, that can be triggered with the Ctrl+Shift with Keymap Switcher.

The Deskbar Indicator shows “Nu” as the NumPad (user) keymap is selected. Ain’t that cool?


Hello together,

I’m currently trying to figure out whats the best approach to get the following keyboard layout to work under Haiku.

As far as I understand from the forum posts, I need to write/program a file like this one: KeyboardLayout.cpp\keymap\preferences\src - haiku - Haiku's main repository

to be able to get the desired layout?
Neo (2) is a german ergonomic layout with multiple layers (up to 6). I tried to use the keymap program to change the alphabetic letters, which works fine to some degree however once it has to go up the layers I’m lost…

Is there a way or maybe a tool which can convert keylayouts from linux to the haiku format? Neo2 is preinstalled on most Linux distributions, or can be activated with setxkbmap de neo (if setxkbmap is installed). Or is there maybe someone who already succeeded in using neo2 under haiku?

If not, is it possible to guide me a bit on how to program the file to use with multiple layers? If I have some sparetime I will then try to port the neo2 layout to Haiku.

Thanks a lot!

That’s to define a geometry, but it seems that what you really want is to change the assignment of keys. Use the Keymap preferences for that, as you have started doing.

For the layers, you can use the modifier keys, that is, change the assignment for the keys when you have, say, Option+Shift pressed down. It seems you can even have a different assignment for a key with Shift than you have with CapsLock.

If that’s not enough or gets complicated or interferes with shortcuts in applications, one idea in this thread is to define several different keymaps and then use KeymapSwitcher to change between those.

There is a command to dump keymaps to editable text files and load those files: keymap.

1 Like

Good day,


Yes, actually, one advantage of Haiku is that whatever the keyboard is, Haiku can turn it into a fully programmable multilayered keyboard, just by adding keymaps and cycling through them with the KeymapSwitcher switch key combination. I haven’t tried yet adding macros, like key combinations to a keymap key to trigger the macro just with the press of a key on a different layer.

Only issue here would be the marking of the keycaps. If you change the keymap and it doesn’t match the keycaps available in your keyboard you may have an issue typing. For such a use case, blank keycaps would solve the issue. The user just needs to remember the location of the keys, or have the keymap open to “spy” while learning.

There are quite some possibilities available without the need of programming some software to drive a keyboard.

If you have a “weird” keyboard, in the sense that the keys are arranged differently (ortholinear, vertically staggered, matrix…), you can just create a new keyboard layout to match that keyboard, and then create the keymaps according to that new keyboard layout in order to fit your specific needs.