PowerToys icon indicating copy to clipboard operation
PowerToys copied to clipboard

Option to disable Ctrl + Alt = AltGr on International Keyboards

Open Eyji opened this issue 3 years ago • 12 comments

Description of the new feature / enhancement

The keyboard shortcuts inconsistency on Windows is a real productivity issue and I don't know how that's possible in 2021. While we have the great Keyboard Manager with remapping capabilities, which is great to finally help me write faster, it does not help with an incredibly old and irritating issue from Windows, explained in this post.

A lot of apps use the Ctrl + Alt + 1 or 2 or 3 or 4 or 0 to quickly convert to a corresponding level header or revert to normal text. Even OneNote does it. (Except reverting to normal text is Ctrl + Shift + N: why ??)

But on international keyboards, Ctrl + Alt is associated to AltGr so instead of creating a 2nd level header, I get a lame "~" character.

There is no workaround other than creating a custom Keyboard Layout + using a AutoHotKey remapping.

Scenario when this would be used?

Non US keyboards + any shortcut using Ctrl + Alt + X

Supporting information

https://answers.microsoft.com/en-us/msoffice/forum/all/disable-ctrlalt-altgr/78fff2b4-c20c-4408-9547-e323114ae522?auth=1

(didnt help)

https://superuser.com/questions/217082/why-dont-the-google-docs-ctrl-alt-shortcuts-work

https://superuser.com/questions/592970/can-i-make-ctrlalt-not-act-like-altgr-on-windows

Eyji avatar Nov 18 '21 21:11 Eyji

I created a review in the Feedback Hub based on your suggestion, please upvote it: https://aka.ms/AAh52qs

Other mentions

Useful workaround for Blender: https://developer.blender.org/T68256#1288470 − Windows doesn't save these changes − It doesn't make sense in apps where (real text) typing is actively used

Workaround by Microsoft Agent: https://answers.microsoft.com/en-us/microsoftedge/forum/all/pressing-altgraph-also-presses-ctrl/87191eec-fcc0-4f0c-809b-382e8af8a0ce − It doesn't make sense because it also disables the other functions of AltGr

Also: https://github.com/eclipse-theia/theia/issues/3885 https://tkainrad.dev/posts/why-keyboard-shortcuts-dont-work-on-non-us-keyboard-layouts-and-how-to-fix-it/ https://stackoverflow.com/questions/42863842/altgr-vs-leftctrl https://stackoverflow.com/questions/58633725/windows-detect-if-right-alt-generates-ctrlalt-altgr-in-current-layout https://forum.figma.com/t/solved-ctrl-alt-c-doesnt-copy-properties-style-data-anymore/1008

https://www.reddit.com/r/Windows11/comments/rr14qq/windows_magnifier_uses_the_ctrlalt_modifier_for/ https://devblogs.microsoft.com/oldnewthing/20040329-00/ https://github.com/microsoft/vscode/issues/50341

VladWinner avatar Jun 05 '22 01:06 VladWinner

IMPORTANT UPDATE

One good developer BladeMight just offered his own workaround for international layouts (the best and trouble-free in my opinion) with Mahou app: at the time of typing Ctrl+Alt+ combinations, the keyboard layout will temporarily change to special one where the symbol mode doesn't involve duplicating AltGr to Ctrl+Alt.

Just open Mahou "Layouts" tab and enter in "Temporary change layout on LCtrl+LAlt combination" field: 67699721 (English US code), then click on "Apply" button.

@Eyji You can freely specify any other (desired) keyboard layout (without AltGr) code for a temporary change (but it makes no difference).

Download (x64): https://github.com/BladeMight/Mahou/releases/download/latest-commit/Release_x64.zip Other builds: https://github.com/BladeMight/Mahou/releases/tag/latest-commit

Here are my settings: image

VladWinner avatar Jun 05 '22 21:06 VladWinner

Addition

If someone undertakes to recreate the feature above: you can take a look at Mahou source code for the temporary layout change: Initial code https://github.com/BladeMight/Mahou/commit/0e935d1955319515b4c093102d1b77735d408ad9 UI + localization https://github.com/BladeMight/Mahou/commit/8ab27cbeb49b160f9aa3e7c8ff6a648518ab5583 Load layouts that are not currently in system list of kbd layouts using WinAPI.(Un)loadKeyboardLayout https://github.com/BladeMight/Mahou/commit/23c0dbccbe96842d025b3dbf8e37f2bcbf3d049e

VladWinner avatar Jun 14 '22 00:06 VladWinner

Does this help ? https://github.com/microsoft/PowerToys/issues/21042

Baccanno avatar Oct 05 '22 12:10 Baccanno

What about the other way round? Like when typing text and AltGr is misinterpreted as ctrl+alt? This for example causes at almost random to do unintended actions in various programs. Seems like a fuck you from Microsoft towards non-English speakers. Because why the hell has this been going on for decades already? By such a gigantic company with gigantic revenues…

StacktraceException avatar Dec 04 '22 15:12 StacktraceException

What about the other way round? Like when typing text and AltGr is misinterpreted as ctrl+alt? This for example causes at almost random to do unintended actions in various programs. Seems like a fuck you from Microsoft towards non-English speakers. Because why the hell has this been going on for decades already? By such a gigantic company with gigantic revenues…

Not non-English speakers, but people using non-US-layout keyboards: that's even more users 😜

Don't make the same mistake as Microsoft who forces someone willing to use English as the input language to install / use the US keyboard layout. Input language and keyboard layout are two different things and should be 100% independent.

sba923 avatar Aug 21 '23 21:08 sba923

uh, any updates on this ? I'm using Colemak layout and it supports AltGr symbols, but when using Ctrl+Alt shortcuts in text editors such as VSCode, it adds unwanted symbols to the text that's being typed !

DanteMarshal avatar Dec 10 '23 06:12 DanteMarshal

This issue has been bugging me forever. I created a custom keyboard layout for Windows but found it impossible to find a workaround using just that. Windows simply does not have a shift state for AltGr that is separate from Alt+Ctrl like xmodmap / XKB and MacOS do.

One solution I have been using is to use a keyboard with QMK / VIA support, treating AltGr as a layer with the required special characters in there. However, this then means the special character no longer work on any other keyboards (e.g. my laptop's built-in keyboard). It's also a pain, so I never bothered remapping all the keys. This method is also not portable between other keyboards afaik.

I think a way Powertoys could resolve this is by allowing the Keyboard remapping to be exported and imported. See #554 and #4452.

  • The functionality of switching keyboards to switch AltGr switch states could be replaced with the group / profile feature described in #4452. Ideally, this would be able to show some sort of keyboard code, like the Windows language bar.
  • If the format is human readable, it should be fairly easy to bulk copy over configurations.

seppestas avatar Apr 26 '24 15:04 seppestas

Honestly, it would be cool if this could be fixed on the OS level. Is it possible to make the windows devs aware of this?

fblz avatar May 06 '24 22:05 fblz

Honestly, it would be cool if this could be fixed on the OS level. Is it possible to make the windows devs aware of this?

This would also be quite backwards incompatible, unless it can be enabled through some setting. Maybe this setting could be added to PowerToys?

Either way, technically, it is a lot more tricky than it seems because AltGr technically emulates ctrl+alt, not the other way around.

The more I think about it, the more I would like something like Keyboard manager to manage the keyboard layout. This means having Keyboard manager do the mapping from AltGr keys to characters / deadkeys.

To get this to work / be useful, we need at least 2 things from the PowerToys Keyboard manager:

  • An easy way to export / import mappings (#4452), and ideally, some typical default layouts that use AltGr like US international, Belgian, ...
  • A way to quickly switch layouts, ideally through integration with the existing language bar (or a way to replace it).

This could fix a lot of other issues I have with the Windows keyboard / language system. E.g I use the same keyboard layout to type US and Irish (~UK) English. The language bar in Windows 11 shows both as just "ENG". Before I was able to use the country flag to distinguish them. Having more control over this would be great.

It would also prevent having to create installers for custom keyboard layouts, and having to use using quite archaic programs to do so.

seppestas avatar May 07 '24 11:05 seppestas

IMPORTANT UPDATE

One good developer BladeMight just offered his own workaround for international layouts (the best and trouble-free in my opinion) with Mahou app: at the time of typing Ctrl+Alt+ combinations, the keyboard layout will temporarily change to special one where the symbol mode doesn't involve duplicating AltGr to Ctrl+Alt.

Just open Mahou "Layouts" tab and enter in "Temporary change layout on LCtrl+LAlt combination" field: 67699721 (English US code), then click on "Apply" button.

@Eyji You can freely specify any other (desired) keyboard layout (without AltGr) code for a temporary change (but it makes no difference).

Download (x64): https://github.com/BladeMight/Mahou/releases/download/latest-commit/Release_x64.zip Other builds: https://github.com/BladeMight/Mahou/releases/tag/latest-commit

Here are my settings: image

mahoe dev seems to have deleted or privated maohe? any other solutions?

Eonflare14 avatar Jun 28 '24 16:06 Eonflare14

@Eonflare14 https://gitea.com/BladeMight/Mahou/releases/tag/latest-commit

VladWinner avatar Jun 28 '24 16:06 VladWinner