Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make Quake mode work with a German keyboard layout #10203

Closed
zadjii-msft opened this issue May 26, 2021 · 22 comments · Fixed by #10666
Closed

Make Quake mode work with a German keyboard layout #10203

zadjii-msft opened this issue May 26, 2021 · 22 comments · Fixed by #10666
Assignees
Labels
Area-Settings Issues related to settings and customizability, for console or terminal Issue-Task It's a feature request, but it doesn't really need a major design. Priority-1 A description (P1) Product-Terminal The new Windows Terminal. Resolution-Fix-Committed Fix is checked in, but it might be 3-4 weeks until a release.
Milestone

Comments

@zadjii-msft
Copy link
Member

zadjii-msft commented May 26, 2021

Should the quake mode work with a German keyboard layout out of the box? The ` key has a special handling on the German keyboard, because it is used to handle accents and is not processed immediately. So ` + a produces à. If you want to type a `, you have to press the ` + [space].

Originally posted by @lafe in #8888 (comment)

@ghost ghost added Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting Needs-Tag-Fix Doesn't match tag requirements labels May 26, 2021
@zadjii-msft zadjii-msft added Area-Settings Issues related to settings and customizability, for console or terminal Issue-Task It's a feature request, but it doesn't really need a major design. Priority-1 A description (P1) Product-Terminal The new Windows Terminal. labels May 26, 2021
@zadjii-msft zadjii-msft added this to the Terminal v2.0 milestone May 26, 2021
@ghost ghost removed the Needs-Tag-Fix Doesn't match tag requirements label May 26, 2021
@JensMertelmeyer
Copy link

The German keyboard layout is entirely different here, like many other languages. Is there anything special about the German layout?

On Quake Engine games, the console was invoked with the key below the escape key, which is ^ on German keyboards. In order to invoke Terminal, I have set it to win + ^

@lhecker lhecker self-assigned this May 27, 2021
@DarthJahus
Copy link

DarthJahus commented May 27, 2021

Maybe the Terminal should detect which key is at that position (keycode) and assign it automatically. Actually, what it does is detect how the user would write ` with his current layout and then assigns the key(s).

On mine, it was Win+alt+shift+&.

I use a custom Dvorak layout.

Of course, after manually changing the binding for Quake mode under Terminal's settings (Actions section), it works without issue.

I have assigned like this: win+< (write it manually)

image

As you said, Quake uses the key under Esc. For me, it's that <, and now, I can invoke Quake mode with Win+<.

@zadjii-msft
Copy link
Member Author

Unfortunately, the terminal settings only allows us to set keys by character, or VKEY name (in some limited scenarios).

I guess ` is VK_OEM_3 on a US keyboard. I wonder - if we added support for oem_3 as a key name, and bound to that by default, what key that would be on a German keyboard.

@DarthJahus
Copy link

I've noticed that on my layout, the terminal defaulted to Win+alt+shift+&. Which is how ` is written with the layout. Would be indeed interesting to bind with key code instead of key characters.

Maybe, in the long term, Windows should have a shortcut manager, where users would be able to see system-wide bindings. Apps would register there with some kind of API. Just an idea.

@DHowett DHowett removed the Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting label May 27, 2021
@lhecker
Copy link
Member

lhecker commented May 27, 2021

@zadjii-msft noticed that the key below the Escape key apparently almost always maps to the scan code 29.
He also had the idea that we could add support for key bindings like vsc(<N>) which creates a key binding not by character but rather by (Virtual) Scan Code. Afterwards we could bind quake mode to Win+vsc(29) by default.

In my opinion that's a really good idea we could pursue.
If no one does it by then I'll likely take a stab at it in the future.

@dag03tsc
Copy link

dag03tsc commented Jun 1, 2021

With the Spanish QWERTY layout, Windows pre-claims the default win+` shortcut for the emojis pane, as well as the more common win+. shortcut. Is it somehow related to this?

Unfortunately, this prevents the usage of the Quake Mode feature OOTB, as it requires a shortcut remap, but it's no drama.

Anyway, I guess it'd impossible to find a suitable fit-for-all-layouts alternative and 'globalSummon' seems to be the best approach.

@tunger
Copy link

tunger commented Jun 2, 2021

I would love to use Umlaut-keys for action binding, specifically ctrl + ö to open the terminal (which is also the default key binding in e.g. VS Code). That's not possible at the moment.
The suggestion from @lhecker seems really good to allow that kind of binding.

@vadimkantorov
Copy link

Same question for US-International layout (that I use to avoid French AZERTY layout). And maybe other layouts that use backtick for typing accents

@dag03tsc
Copy link

dag03tsc commented Jun 2, 2021

I would love to use Umlaut-keys for action binding, specifically ctrl + ö to open the terminal (which is also the default key binding in e.g. VS Code). That's not possible at the moment.

Maybe Unicode could come in handy for that purpose.

With the Spanish QWERTY layout and win+\u00f1 as mapping, I can summon the action with the win+ñ actual keybinding indeed.

Try to use ctrl+\u00f6 as mapping. Does it work for you?
But I'd recommend you to change the VS Code keybinding before anything else, just to make sure it's free and WT can claim it right.

@Raton-Laveur
Copy link

French AZERTY layout

which actually has ² below the ESC key. Remapping the quakeMode action as "win+²" does not do anything.

@dag03tsc
Copy link

dag03tsc commented Jun 6, 2021

French AZERTY layout

which actually has ² below the ESC key. Remapping the quakeMode action as "win+²" does not do anything.

@Raton-Laveur, try to map it with Unicode as win+\u00b2.

You must write that inside thesettings.json file with any text editor; otherwise, it won't work, because the GUI editor forbids keybindings with backslash characters.

I've tested this approach with a bunch of weird chars and it seems to be working pretty good, so you may use any Unicode char.
Let us know if it works for you too.

@Raton-Laveur
Copy link

@dag03tsc it works, thank you.

@dag03tsc
Copy link

dag03tsc commented Jun 7, 2021

@Raton-Laveur, I'm glad to hear that! You're welcome!

There seems to be some kind of inconsistency with the GUI remapping method.

Some chars are parsed to its Unicode \uXXXX, while others don't, and I'm not really sure why, but I guess it could be charset-driven somehow.

Maybe it relays on the charset of the settings.json file, or it relays on the system's default charset instead.

As an example, with the Spanish QWERTY layout, win+ñ goes right inside the setting.json as is, but it should be listed as its win+\u00f1 Unicode reference instead. Otherwise, the action cannot be summoned.

Anyway, I guess this could be fixed just by parsing all chars with no discrimination at all but, of course, exclude special keycodes like +, win, numpad_*, f*, etc.

@tunger
Copy link

tunger commented Jun 7, 2021

Try to use ctrl+\u00f6 as mapping. Does it work for you?

@dag03tsc thanks a lot, it works!
Would probably be worth mentioning in MSDN that this possibility exist: https://docs.microsoft.com/en-us/windows/terminal/customize-settings/actions#accepted-modifiers-and-keys

@vadimkantorov
Copy link

Also, if this settings JSON flavor supports comments, maybe worth mentioning some instructions there directly inline

@lhecker
Copy link
Member

lhecker commented Jun 7, 2021

I've installed the French locale and its AZERTY layout. A key binding for win+² works as expected for me.
Please make sure to save your settings.json file as UTF-8 and not as CP 1252 or something...


(cc @carlos-zamora)

But the way key bindings currently work, they might break if you switch between multiple keyboard layouts.
They're parsed only once during app start. If you switch to a different keyboard or language layout later on, the virtual keycodes will not match anymore and the keybinding will appear to be broken.

For instance: If you start Windows Terminal with a win+² key binding it'll be recognized as a shortcut for "windows key + VK_OEM_7" (VK_OEM_7, or 0xDE, is the virtual key code for ² on a French AZERTY keyboard).
If you then switch to an English keyboard - even if you keep the AZERTY layout! - the very same key will now be recognized as VK_OEM_3, or 0xC0, instead and the key binding will not work.
For quake mode this issue is amplified as we also only call RegisterHotKey once with the virtual key code determined during app start.

For this reason and many more we certainly need to listen for WM_INPUTLANGCHANGE in the future (also mentioned in #8871).

ghost pushed a commit that referenced this issue Jul 13, 2021
This commit is a preparation for upcoming changes to KeyChordSerialization for #7539 and #10203.
In order to support variadic macros, /Zc:preprocessor was enabled, which required changing unrelated parts of the project.

## PR Checklist
* [x] I work here
* [x] Tests added/passed

## Validation Steps Performed

* Project still compiles ✔️
ghost pushed a commit that referenced this issue Jul 14, 2021
This commit is a preparation for upcoming changes to
KeyChordSerialization for #7539 and #10203.  It introduces several
string helpers to simplify key chord parsing and get rid of our implicit
dependency on locale sensitive functions, which are known to behave
erratically.

Additionally key chord serialization used to depend on iteration order
of a hashmap which caused different strings to be returned for the same
key chord. This commit fixes the iteration order and will always return
the same string.

## Validation Steps Performed

* Key bindings are correctly parsed ✔️
* Key bindings are correctly serialized ❔
@ghost ghost added the In-PR This issue has a related PR label Jul 15, 2021
@ghost ghost closed this as completed in #10666 Jul 20, 2021
@ghost ghost added Resolution-Fix-Committed Fix is checked in, but it might be 3-4 weeks until a release. and removed In-PR This issue has a related PR labels Jul 20, 2021
ghost pushed a commit that referenced this issue Jul 20, 2021
This commit introduces an alternative to specifying key bindings as a combination of key modifiers and a character. It allows you to specify an explicit virtual key as `vk(nnn)`.
Additionally this commit makes it possible to bind actions to scan codes. As scan code 41 appears to be the button below the Escape key on virtually all keyboards, we'll be able to bind the quake mode hotkey to `win+sc(41)` and have it work consistently across most if not all keyboard layouts.

## PR Checklist
* [x] Closes #7539, Closes #10203
* [x] I work here
* [x] Tests added/passed

## Validation Steps Performed

The following was tested both on US and DE keyboard layouts:
* Ctrl+, opens settings ✔️
* Win+` opens quake mode window ✔️
* Ctrl+plus/minus increase/decrease font size ✔️
Rosefield pushed a commit to Rosefield/terminal that referenced this issue Jul 22, 2021
This commit introduces an alternative to specifying key bindings as a combination of key modifiers and a character. It allows you to specify an explicit virtual key as `vk(nnn)`.
Additionally this commit makes it possible to bind actions to scan codes. As scan code 41 appears to be the button below the Escape key on virtually all keyboards, we'll be able to bind the quake mode hotkey to `win+sc(41)` and have it work consistently across most if not all keyboard layouts.

## PR Checklist
* [x] Closes microsoft#7539, Closes microsoft#10203
* [x] I work here
* [x] Tests added/passed

## Validation Steps Performed

The following was tested both on US and DE keyboard layouts:
* Ctrl+, opens settings ✔️
* Win+` opens quake mode window ✔️
* Ctrl+plus/minus increase/decrease font size ✔️
@sbatten
Copy link
Member

sbatten commented Aug 25, 2021

I am using Colemak Mod DHk and am unable to bind backtick or the vk or sc code to quake mode. Switching to basic US Qwerty fixes the issue, but backtick is not special in my layout like German. Is there some checking going on that prevents my keybind that shouldn't be?

@lhecker
Copy link
Member

lhecker commented Aug 25, 2021

@sbatten I've installed the US ANSI Colemak-DHk and it works as intended in the Preview version of Windows Terminal (1.11.2362.0).
Are you on the same version? And if so: Do you use the same layout or a different one?

DHowett pushed a commit that referenced this issue Aug 25, 2021
This commit is a preparation for upcoming changes to KeyChordSerialization for #7539 and #10203.
In order to support variadic macros, /Zc:preprocessor was enabled, which required changing unrelated parts of the project.

* [x] I work here
* [x] Tests added/passed

* Project still compiles ✔️

(cherry picked from commit 32fbd4c)
@sbatten
Copy link
Member

sbatten commented Aug 25, 2021

@lhecker I am using 1.10.1933.0 (Preview from the store on Win 11) and yes that is the same layout. My default seems to be:
image

Also, I also have keyboard layouts available, not sure if that matters. i.e. win+space toggles between layouts

@lhecker
Copy link
Member

lhecker commented Aug 25, 2021

@sbatten Oh in that case you'll have to wait until 1.11 unfortunately.
The required fixes that introduced vk() and sc() are only part of 1.11, which should be in (public) preview relatively soon.

@sbatten
Copy link
Member

sbatten commented Aug 25, 2021

ah thanks for the clarification

@ghost
Copy link

ghost commented Aug 31, 2021

🎉This issue was addressed in #10666, which has now been successfully released as Windows Terminal Preview v1.11.2421.0.:tada:

Handy links:

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Settings Issues related to settings and customizability, for console or terminal Issue-Task It's a feature request, but it doesn't really need a major design. Priority-1 A description (P1) Product-Terminal The new Windows Terminal. Resolution-Fix-Committed Fix is checked in, but it might be 3-4 weeks until a release.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants