Option/Command/Alt Confusion

I will repeat myself more clearly:

CtrlCmd/WinOpt/Alt

It is default PC keyboard style.
The first entry is the MacOS term for the key, the second entry after the slash is the MS Windows term for the thing.

You are taking about physical key scancode assignment, not semantic meaning. Physical scancode assignment is private to specific platform. So Windows key scancode have only meaning for Windows and others OSes that follows Windows conventions and Command key have only meaning for Mac OS. Using keyboard for incompatible platform it is not designed for is undefined behavior and keys may map in strange random way. Command - Windows key mapping is one example of that random coincidences.

Mac OS have no such thing as Windows key and Windows have no such thing as Command key (most semantically equivalent thing is Ctrl key).

No, I am talking about function. Quote from the internet: “Note that if you’re using a PC keyboard with a Mac computer, the Windows key functions as the Command key.”

You are not supposed to use Apple hardware with Windows keyboard. Doing it is a hack and undefined behavior. Use at own your risk.

I have seen dual Win/Mac keyboards with hardware switch that swap scancodes for modifier keys. That is proper solution if you want to use the same keyboard with both Windows and Mac.

If it works, there is no problem in that.

MacOS also allows for swapping the modifier keys in the keyboard settings (per keyboard), which I do when I use a Windows keyboard on a Mac. This makes the physical keys match what I expect (the “Cmd” key role is the key next to the space bar, which is labelled “Alt” on a Windows keyboard.)

Haiku by default maps a Windows keyboard as above, Cmd next to the space bar (which I like), but then it makes Mac keyboards have the Cmd and Opt keys swapped. That is something Haiku could fix in some way, or users could swap them in the keymap as I do when using a Mac. As everyone has said in 20 different ways, Windows and Mac keyboards have Opt/Alt and Cmd/Win swapped in position. This sucks because it results in 200 message discussions like this and is very confusing. There is no real solution that can fix this for everyone, which PulkoMandy said very early in this discussion.

BeOS chose to swap the meaning of the Win and Alt to make a PC keyboard work more like a Mac. Some people think this is “wrong”. But at this point I do not think Haiku will change this. Certainly not for R1.

Overall I am not sure anything productive has come of this whole discussion. I just went back to the beginning and overall each person just keeps restating the same thing.

5 Likes

As the thread starter, I agree about the discussion stall. It’s apparent that the development team is aware of the issue. I wouldn’t mind if the thread is locked.

My keyboard looks like this:

Left side:
CtrlWinAlt (considering Haiku’s keyroles, that’s: CtrlCmd/WinOpt/Alt)

Right side:
AltGrWinMenuCtrl

Considering Haiku’s keyroles, that currently means/acts as:

Opt/Alt[ nothing here ]MenuCtrl

With that the physical AltGr key (Left Alt if you wiil due to its scancode) does allows me to type: \ | @ # ~ €, etc. (some of those are definitively necessary when programming / using the command-line).

What happens with right Win key? it does nothing. And if I want to remap it to be the same function as its left side counterpart (for consistency’s sake)… now I have to use right Win to type those “level 3” characters, and that is just plain wrong.

What it cannot do, is provide a separation between input of “Level-3” chars, and whatever function is assigned to the “Win/Super/Meta” (Opt by default in Haiku).

That’s my main issue. Rest of things (key labels on GUI/Docs, “Ctrl+C vs Alt+C”… can be addressed separately/later, or just tolerated :smiley:).

Would it be so extremely difficult to write a conversion tool to do a one-time update of those keymaps when introducing that new “AltGr role”?

Even with my limited programming skills, I’m more than willing to at least attempt to write (or help to write) something like that, provided we agree on an output format.

Holding back a solution because of compatibility with existing keymap files… I guess I can’t agree with that reasoning.

Aside:

As others have expressed, I also would like these discussions to be more lighthearted. We’re here to have fun, and try to further our loved OS, right?

(Hope my posts can convey that intention, despite my crappy “English”, and some of my frustrations with this darn keyboard issues :stuck_out_tongue:)

It’s more the schema change than the data migration if you understand my analog. We have to add another entry for AltGr, which it seems more and more like we have to do at some point.

It is used for shortcut characters like left Alt since we took right Alt for extra text characters.

The discussion is fine, people tend to get uptight about AltGr that’s why I call it the Quest for the Holy AltGr because it has quasi-religious fervor surrounding it.

Maybe it should do the same as left Win key: an Option key? And right Alt key to be Command key? Alt Gr is a Windows concept and Haiku is not required to follow it, Haiku has Option key instead.

1 Like

Seems I can’t express it well enough in English. It DOES NOTHING on my keyboard: literally an empty key on the Keymap preflet. (will attach a screenshot, when using “Generic 105-keys” US-International layout, otherwise default settings)

It sounds like from the earlier discussion that at least some Latin American keymaps would use both AltGr and Option (Windows key) maps to input different characters if they could.

At least for ABNT2 they don´t . AltGR enter the extra character, Win key runs OS tasks ( open start menu , Device manager, etc ) . Also, at least in win10 and with a keyboard near me, both Win keys ( left and right ) work same way. Alt-Gr works as expected also, inputting the strange characters.

1 Like

One question : how is the flow in code ? The keyboard driver pass up scancodes, then app_server decides on what was pressed and how to react ? Or the code that decides on which letter/number/modifier was pressed is in another part ?

That’s me pressing the Win key on an “Generic 105-keys International” keyboard layout, having selected the “US-International keymap” (hoping that helps to get the point across), but otherwise default Haiku settings.

Right clicked on the Win key, to show that there’s nothing in there to map that key to (that doesn’t screws things up further :-D).

The docs explain how the keyboard handling code works : The Haiku Book: Keyboard

It appears that you unselected the Command role from that key, use the right click menu to select it again (or a different role if you want to change it but I don’t think you do).

If i do that… the physical right control key is the one left empty. Do you want a screenshot?

Scratch that… Will erase ALL settings and try again.

Edit:

Seems part of my confusion comes from the fact that at least “Spanish”, “Latin-American”, and “US-International” leave that right win key (the physical one) undefined.

I can assign Cmd there (Seems I had screwed my custom keymap file while trying to find something that works). But yea… having “Cmd” (Alt in my head) on the Win-key place is far from ideal for me.

Well you can change that in your keymap, I suggest you use the Modifier keys window as it sets modifiers in matched pairs.

The real question is what the default should be for everyone? It seems to me most people prefer AltGr to function as option so it should be the default at least until we implement an AltGr role in the keymaps. I suppose it depends on the keymap. If the Windows key is really not getting set in some keymaps that is a bug in the keymap definition.

Selected “Spanish”, and indeed the “Modifiers key” windows warns that both sides do not match (same for plenty of other keymaps).

Settled for now to CtrlOptCmd[space bar]CmdOptMenuCtrl.

Doubt I’ll last long before switching back to “Win/Lin” mode, and getting tripped by having to use Win key instead of AltGr for level-3 input either way.

Muscle memory for (physical) Ctrl+C/Ctrl+V [*] and AltGr usage is just too stubborn in my case, I guess.

[*] Too bad Shift+Insert and Shift+Delete doesn’t seems to be working as an alternative :slight_smile:

Seems to be the case, as it is clearly visible if you select the “Generic 105-keys international” layout, and then select each of the keymaps available. A lot of them leave that key empty.

Selected “Spanish”, and indeed the “Modifiers key” windows warns that both sides do not match

This is normal for any keymap that has it’s right Alt and right option switched. It’s only a bug if the right Windows key is not being set to right Alt properly. I anticipated that our AltGr shenanigans might be problematic for some and coded in that warning.