Model 01 and other keyboard with different layout in Linux?

Hey,

I use Norwegian as keyboard layout on my linux computer in my day to day workings. That doesn’t work so well with the Model 01, so I was wondering if anyone has ideas for how I can have linux (or model 01?) switch based on what keyboard I type on?

1 Like

This is not a problem specific to Linux. I’m having the same problem on Windows. I was considering opening a thread about it as well. Whatever layout the host OS is configured with, it tempers with the keycodes sent from the model01. I wonder if there’s a way to disable layouts entirely, but you’d have the same problem all over on a different computer you plug your keyboard in.

Right now, I’m considering programming my firmware to “work with” the standard German QWERTY layout that most computers are configured with by default here.
That will blow up on me as soon as I plug the keyboard into a pc that does not run the German layout, which is happens more often than you’d think.

But then again, how often does one really plug their keyboard into other people’s computers? Not often would be my guess so maybe I’m wasting my time worrying about it.

What I’ve done is flash my Model01 with a keymap designed so that, after OS translation, I get the key I want.

I’m not sure how much harder that would be for alternate languages, though. I’m using Dvorak, so only had to tweak a couple of the symbol keys. I’ve got my sketch on github; specifically, I map the key labeled = to send [, which is then mapped by the OS to be /. Something similar might work for you, you would just have to figure out how your Norwegian layout is translating keys. If your regular keyboard’s printed caps don’t match what you get when you press them, this is easier to figure out. Let me know if that didn’t make sense, and I can try again. If you’ve got an example of a key or two you want to change, I might be able to explain more clearly.

What’s the benefit of setting the keyboard firmware to a specific layout, rather than leaving it as QWERTY and setting the layout in the OS?

I did the same. What layout did you end up using?

Well, for one thing, if you configure the layout in your firmware, you have to only do it once and it’ll work on any computer you plug your keyboard in. If you want to change the layout on the computer, you have to do it on every computer that you use. Depending on the layout, that’s not always easy or even possible (e.g. if a layout installation requires you to have root permission.

Also, Kaleidoscope, the M01’s firmware, is so much more powerful than what an operating system allows you do to change a layout.

4 Likes

It depends if you’re carrying the keyboard with you or not, if you’re using it (for example) with a laptop where you sometimes want to use the built-in keyboard, if you’re able (permissions-wise) to change the layout in the OS, etc.

If you’re carrying your keyboard with you, it makes sense to customize the heck out of it, including any alternate keymaps you use, so that you can plug it into any computer that’s expecting to get QWERTY, and it “just works”, without having to change the OS on multiple computers, some of which may not belong to you.

If you’ve got a laptop or other alternate keyboard on the same machine (that’s not customizable), that you want to use with a non-QWERTY layout, it makes sense to let the OS do the layout mapping, and configure your Model01 as I described above, so that it does what you want after the OS applies the layout mapping.

If you’re not able to change the OS keymap settings, then you want the mappings done in the firmware.

If other people need to sometimes use your computer, it’s nice to have the OS set to QWERTY.

For example, I backed at the 2-keyboard level.

My Model01 for home use, which I’ll be using primarily with a desktop and occasionally with either a MacBook Pro or a Win10 laptop (which may learn to dual-boot to Linux), is configured to assume that the OS is handling Dvorak mapping. Note that this doesn’t stop me from using the extras that Kaleidoscope provides, it just determines what keycodes I use in my layout - essentially, for the punctuation keys, I need to do the inverse of the Dvorak mapping, so that when the Dvorak mapping is applied, I get the correct key.

My work computer, however, is set to QWERTY at the OS level. I’ve got the keyboard that came with it available for others to use - for example, if we’re pair-programming at my desk. That board sits on the back of the desk most of the time, while I use a board that has the Dvorak mapping and other customizations for my daily driver. Currently, that’s a TEK (Truly Ergonomic Keyboard); once I get my second Model01, that’s where it’ll live, with a natively Dvorak keymap & my other customizations I’ve worked out on the first Model01.

2 Likes

This should be possible to set up with udev rules. I once had a rule to detect a Yubikey device and set its “keyboard” layout to qwerty, otherwise it wouldn’t give the one-time password correctly (my default layout is Dvorak). This didn’t affect my regular keyboard.

There’s an answer here which shows how it should be possible.

But I can’t get it working! My Model 01 is still spitting out translated letters until I force it to the standard US map with setxkbmap us.

1 Like

I’m using the following snippet in a file in /etc/X11/xorg.conf.d to do this on Arch linux:

Section "InputClass"
  Identifier "keyboardio"
  MatchIsKeyboard "on"
  MatchProduct "Keyboardio"

  Option "XkbLayout" "us"
EndSection
3 Likes

This seems to be a great track, and it says in the Xorg log now that my keyboardio uses US layout, but once gnome etc is started it is back to norwegian. Do you use gnome, or something else for your desktop?

I use i3 with many Gnome components, including the gnome-session-manager. I don’t set any keyboard options in any of the GUI settings apps.

I have the same problem: I’d like to use German layout on the keyboard of my ThinkPad and US layout on the Model 01. I added Nathan’s snippet to xorg conf and I can see in the logs that both keyboards are assigned the correct layout (de, and us). However, in the graphical environment (Xubuntu, Xfce), these settings seem to be overridden, and I have either German layout on both keyboards or US layout for both (I can switch between the two layouts with the taskbar widget). Any advice on how to fix this would be most welcome.

Edit: I tried to using setxkbmap to configure layouts on a per-keyboard basis, but depending on which device I choose either nothing happens or both keyboards are changed to the same layout.