Keyboard Shortcuts should follow the rule of Windows with Ctrl & Alt Swapped

This is a discussion I’d like to have surrounding Keyboard Shortcuts…

See the following PR (WebPositive: Change back and forward shortcuts to Ctrl+left and right
) for context: https://review.haiku-os.org/c/haiku/+/7290 with a touch of (BTextView: Update word-wise/line-wise shortcuts
) for additional context: https://review.haiku-os.org/c/haiku/+/7289/23

The idea here is define a standard for how Haiku does Shortcuts. Skipping to the end I propose that Haiku follows the convention of using Shortcuts like Windows does but with Ctrl and Alt swapped.

A little history here as background: when BeOS started out it ran on the BeBox which used a standard PC keyboard then they switched to PPC Macs which used a command key and then they switched back to Intel PCs but with an Alt key and a Windows key.

When BeOS switched from PPC Macs to x86 PCs they decided to use Alt instead of Ctrl as the main shortcut key since it emulated the position of the Command key on a Mac keyboard and that has continued this way in Haiku to this day.

While this solution mostly solved the problem for those used to Mac keyboards, it didn’t solve the problem of people coming from Windows or Linux and are used to how keyboards work on those OSs. For those users Be added a “Switch to Windows/Linux mode button” in Keymap Preferences which swapped Ctrl and Alt around so that the keys would then behave how those users expected them to from Windows.

These shortcuts effect 3 major areas:

  1. Navigation in text boxes
  2. Terminal Commands
  3. Twitcher and Back and forth in browser

For navigation in text boxes you use Alt to navigate line-wise, and option/Windows key to navigate word-wise. You can switch Windows/Linux mode and that makes Ctrl do line-wise navigation instead of Alt. Some people don’t want to use Windows/Linux mode but still want to use Ctrl for line-wise navigation, so what I’ve done in PR 7289 above is to make both Ctrl and Alt do line-wise navigation while Option/Windows key does word-wise as long as there’s not a conflict.

For Terminal we use Alt+C for copy which is great because otherwise it would conflict with Ctrl+C to signal an interrupt. If you switch to Haiku/Linux mode you use Ctrl+C to copy but now you have to use Alt+C signal an interrupt instead which is a bit strange shrug.

The last case is Twitcher and Back and Forward in Browsers. These two actions uniquely use Alt instead of Ctrl on Windows so the idea here is we swap that and use Ctrl instead of Alt. So that activates Twitcher on Ctrl+Tab which is exactly what we are currently doing in Haiku and inherited from BeOS. The commit that triggered this whole discussion was that I also made the Back and Forward shortcuts in WebPositive swap Alt for Ctrl following the pattern of Windows with Ctrl and Alt swapped. The idea here on Windows is that you use Ctrl+Left and Right to do line-wise navigation in text boxes and the URL bar of your browser and then you use Alt+Left and Right to go Back and Forwards that way you don’t mix the two up.

This is where the controversy came in because nephele was dead set against this idea and against the whole premise. So I’d like to propose an alternatives which is

We go the “Mac” way and use Alt for Switcher and WebPositive Back and Forwards and line-wise navigation in Text Boxes and deal with the conflicts as macOS has. This would mean that we should change the Twitcher shortcut from Ctrl+Tab to Alt+Tab and leave the WebPositive Back and Forwards how they are with Alt+Left/Right.

Another more radical proposal might be to go full Windows and stop using Alt but use Ctrl instead for text box nav, shortcuts. We’d have to figure out how to deal with the conflict between copy and interrupt in Terminal though as Windows/Linux have.

However I don’t think that’s in the spirit of what BeOS was trying to achieve. I realize I’m not going to make everybody happy here but this is my cohesive shortcut design proposal: copy Windows with Ctrl and Alt swapped, like Be mostly did.

1 Like

As a user, I see no problem with copying Windows where it makes sense to do so. But in this situation, what is the actual benefit? Nobody who wants to swap Ctrl and Alt can explain why they want to do so, except that it will make Haiku “more familiar”. I don’t think that’s necessary. For a user switching to Haiku, it will take maybe 10 minutes to readjust.

Is “Windows does it this way” the only reason here?

My thinking here is that we should use the command key (Alt, by default) for all shortcuts unless there is a good reason to do otherwise.

Examples of cases where there is a reason to do otherwise:

  • The linewise navigation in BTextView: this is a global shortcut handled by the widget itself, as a result, it is a good idea to move it out of the “command” key, leaving that available for the applications. An example of an application using command+left/right for something else than word-wise navigation is WebPositive for its back and forward shortcuts.
  • The twitcher: likewise, this is a global shortcut. I think I would even put it on the “windows” key together with the other window management features.

I think going about it this way results in predictible and consistent shortcuts. Whereas “whatever Windows does” doesn’t necessarily leads us there.

1 Like

Yes, exactly, it’s simple and consistent.

I have been using Linux and NetBSD some lately, enough that I start to have a reflex to use Ctrl for some things. But I never really know which way it’s going to go. Huh, “back button” is Alt-Left. Ctrl-C doesn’t work on the terminal emulator, of course, so maybe it’s Shift-Ctrl-C. Bleah.

So nice to use Haiku, where Ctrl is for Terminal, Alt is for the UI, and Option is for the keyboard (try typing `notificações" without an Option key dedicated to the keymap.)

I switch between physical Mac and Windows computers all the time. I just use the correct layout for the keyboard I am using. When I used BeOS it was mostly on PowerPC so I used the standard BeOS scheme. But even when I was using Intel I used to standard layout.

For me, the command key being in the Mac position is nicer. Because my fingers stretch less. But I can deal with it on a PC using Windows just fine.

For me, especially coming from an era when every 8-bit and 16-bit computer had its own layout, this is such a non issue, i can’t really understand why anyone has a problem. Can we not just use what Be decided and not waste time reinventing the wheel?

I might be exceptionally dumb then, because despite using BeOS since R5 (2.5 years as my main OS)… I never was able to get used to the “use alt/cmd instead of ctrl”.

I use Haiku in (windowed) VMs a lot, and the switching back and forth between Haiku’s and host makes dealing with the different shortcuts a mayor pain point for me.

Anyway… /me goes back to the python recipes.

No one suggested changing this. This post is about very specific details of a small set of shortcuts:

  • Twitcher using alt+tab instead of ctrl+tab in BeOS mode, and so being moved to Ctrl+Tab in Windows mode (not matching Windows)
  • The word-wise navigation shortcut in BTextView and its conflict with other shortcuts involving the arrow keys: back/forward navigation in Web+ and increase/decrease quote level in Mail.

Let’s keep the discussion focused on these specific ones. We don’t need a hundred people explaining how shortcuts work in BeOS and why it’s different from Windows by default.

1 Like

Honestly, I don’t think that follows. I think twitcher (Or the new replacment…) should use alt-tab in either mode. It’s alt-tab in windows, it’s alt-tab in linux, it’s alt tab in macos etc. I don’t know of a desktop who does this differently.

Except windows also support win+tab too, for a different way to switch between windows.

I think the “lin/win” mode toggle should set a proper setting intead of or in addition to just remapping keys. So edge cases like twitcher can ignore this. (and maybe we can have input_server even treat alt-tab differently so it can never be eaten by client applications and is always delivered to twitcher)

1 Like

Is “Windows does it this way” the only reason here?

Two reason, one is Windows does it that way, but the second reason is so the shortcut doesn’t conflict with line-wise text box shortcuts. I assume that’s why Windows switched the Back/Forward shortcut to Alt. The problem arises when you’re editing text in a text box in Web+ and you want to go to the beginning of the line so push Alt+left, and oops the browser goes back instead and you lose work. We could alternatively disable back and forward shortcuts when you’re on a text box or URL bar, that’s what Macs do anyway.

I think twitcher (Or the new replacment…) should use alt-tab in either mode. It’s alt-tab in windows, it’s alt-tab in linux, it’s alt tab in macos etc.

This is the example of BeOS and this Haiku switching the shortcut to Ctrl+Tab to follow the rule of being like Windows with Ctrl and Alt swapped.

If we want to continue along this path, we should swap the Web+ back and forward shortcuts too but perhaps this is the time to reevaluate what we’re doing instead. I have to admit that Ctrl+Tab is a bit strange to me too, but I’ve gotten used to it.

Keyboards have a dedicated “go to start of line button”, so this consideration to me is more an edge case (Unless you have a laptop with 60% keyboard, and somehow no replacement buttons for this), in addition WebPositive selects the entire line by default if you click the adress bar. This means you can just start typing immidiently for a replacement URL, which I’d assume is most cases for why someone would use “go to start of line” in the web adress bar.

I agree there is a conflict, but even on MacOS this hardly matters. Among other things because “going back” and “going forward” in Safari is incredible undestructive, you can do this easily, even with a gesture and basically never have to worry about loosing work, and switching back is pretty much instant with the rendering available.
I’ve only seen links2 on linux come close to that level of user compfort, ideally WebPositive can match that someday.

As for disabeling alt-back alt-next when you are in a URL bar. That happens to work already, just tested that. If you have the url bar focused alt-left will not go back, so we follow MacOS here already for the adress bar. The same problem btw is also why firefox disabled the “backspace goes back” thingy. I think we may be able to match macos for textboxes in websites if needed.

In any case,
The twitcher part for me is the more pressing thing. The ctrl-tab shortcut is uncompfortable to use for me, so that is a big reason why i’d want it changed. I actually am using a mac keyboard currently on my haiku machine, and am quite used to the cmd-shortcuts by now.

Honestly I want to keep Haiku shortcuts as is and I do not want any changes.

1 Like

Testing Twitcher with alt-tab enabled too works fine. Though Vision for example eats the keypress for alt (without anything else.) but Renga and WebPositive do not. I guess this is a fixable edge case.

I can upload the patch to gerrit currently it only enables alt-tab in addition to ctrl-tab. In effect it will work the same way in both modes.

I don’t like to use home and end keys preferring Alt+Left/Right but I guess that’s my problem since you’re right that’s what those keys are for.

Yeah that’s a decent way to go I guess, make both Ctrl and Alt+Tab activate twitcher, except the conflicts in Web+, Vision.

That’s another way to go maybe not change any keyboard shortcuts. But I wanted to have this conversation first to give nephele and others the opportunity to express their opinions.

You didn’t want to change the Tracker Move to Trash shortcut either, at least you’re consistent. shrug. I want everybody to have a voice, so we pick something even if what we pick is to change nothing at least that is the choice we made together.

It would be neat if you could map those globally for you with an input_server filter, so alt-left alt-right map to home and end and then always do what you expect. And applications cannot interfere. That would be a (somewhat unsupported, but expected to work) user-level interface but i think this could work.

I also actively use Opt+left/right arrow keys shortcut for SAT tab navigation. Page Up/Down keys are often not present in keyboards or hard to access (need Fn keys etc.).

Alt+Tab for global window switching may be not a good idea when Alt is used as command key, because it is located in namespace of regular application shortcuts. So any application can use this shortcut and using shortcut globally may break things.

Something like Opt+Tab is more consistent because it use global shortcut namespace like SAT.

But people seldom switch completely in one day. I have been using both Windows and Haiku for years, and much prefer doing the same thing on each OS.

I often use Opt+Left/Right for word-wise navigation and so when I put a window in a stack it breaks my shortcuts so there’s a conflict. I’m not against having shortcuts for S&T just not ones that conflict with apps. Unfortunately just about every Opt key is already taken by keymaps for more characters so there’s not much left for us to use. For system settings we often use Ctrl+Alt but we’re already using that with arrow keys to switch workspaces. We could use Ctrl+Opt arrows I suppose and then use up and down instead of pg up and pg down to navigate through stack groups.

You’re right there is a conflict here with tabs.

The usual shortcut for this is action, Twitcher that is, is Alt+Tab on other OS’s, so unless my Windows with ctrl/alt swapped shortcut plan flies that is the shortcut to use, assuming we can deal with app shortcut conflicts.

Just hopping into the thread to mention that at least one app is currently using ALT+TAB: Genio opens/switches between .h and .cpp files with that.