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

CTRL modifiers don't work on non-latin layouts #2845

Closed
Felixoid opened this issue Dec 7, 2022 · 17 comments
Closed

CTRL modifiers don't work on non-latin layouts #2845

Felixoid opened this issue Dec 7, 2022 · 17 comments
Labels
bug Something isn't working fixed-in-nightly This is (or is assumed to be) fixed in the nightly builds. keyboard Keyboard mapping/handling Wayland X11

Comments

@Felixoid
Copy link

Felixoid commented Dec 7, 2022

What Operating System(s) are you seeing this problem on?

Linux X11, Linux Wayland

Which Wayland compositor or X11 Window manager(s) are you using?

KDE plasma, but it's reproducible on both X11 and Wayland

WezTerm version

20221206-093635-92e851d6

Did you try the latest nightly build to see if the issue is better (or worse!) than your current version?

Yes, and I updated the version box above to show the version of the nightly that I tried

Describe the bug

As described in #678, the CTRL modifiers don't work in the terminal when the RU keyboard layout is active

To Reproduce

Open wezterm, change layout to non-latin, try ^c or ^s

Configuration

no additional configuration

Expected Behavior

ctrl-shortcuts should work by Phisical(S) and not Char('ы')

Logs

> wezterm --config debug_key_events=true
15:34:08.937  INFO   wezterm_gui::termwindow::keyevent > key_event RawKeyEvent { key: Physical(LeftControl), modifiers: NONE, phys_code: Some(LeftControl), raw_code: 37, repeat_count: 1, key_is_down: true, handled: Handled(false) } 
15:34:08.937  INFO   wezterm_gui::termwindow::keyevent > key_event KeyEvent { key: Control, modifiers: NONE, repeat_count: 1, key_is_down: true, raw: Some(RawKeyEvent { key: Physical(LeftControl), modifiers: NONE, phys_code: Some(LeftControl), raw_code: 37, repeat_count: 1, key_is_down: true, handled: Handled(false) }) } 
15:34:08.937  INFO   wezterm_gui::termwindow::keyevent > send to pane DOWN key=Control mods=NONE
15:34:09.348  INFO   wezterm_gui::termwindow::keyevent > key_event RawKeyEvent { key: Physical(S), modifiers: CTRL, phys_code: Some(S), raw_code: 39, repeat_count: 1, key_is_down: true, handled: Handled(false) } 
15:34:09.348  INFO   wezterm_gui::termwindow::keyevent > key_event KeyEvent { key: Char('ы'), modifiers: CTRL, repeat_count: 1, key_is_down: true, raw: Some(RawKeyEvent { key: Physical(S), modifiers: CTRL, phys_code: Some(S), raw_code: 39, repeat_count: 1, key_is_down: true, handled: Handled(false) }) } 
15:34:09.348  INFO   wezterm_gui::termwindow::keyevent > send to pane DOWN key=Char('ы') mods=CTRL
15:34:09.349  INFO   wezterm_term::terminalstate::keyboard > key_down: sending "ы", Char('ы') CTRL
15:34:09.443  INFO   wezterm_gui::termwindow::keyevent     > key_event KeyEvent { key: Char('ы'), modifiers: CTRL, repeat_count: 1, key_is_down: false, raw: Some(RawKeyEvent { key: Physical(S), modifiers: CTRL, phys_code: Some(S), raw_code: 39, repeat_count: 1, key_is_down: false, handled: Handled(false) }) } 
15:34:09.443  INFO   wezterm_gui::termwindow::keyevent     > send to pane UP key=Char('ы') mods=CTRL
15:34:09.951  INFO   wezterm_gui::termwindow::keyevent     > key_event KeyEvent { key: Control, modifiers: CTRL, repeat_count: 1, key_is_down: false, raw: Some(RawKeyEvent { key: Physical(LeftControl), modifiers: CTRL, phys_code: Some(LeftControl), raw_code: 37, repeat_count: 1, key_is_down: false, handled: Handled(false) }) } 
15:34:09.951  INFO   wezterm_gui::termwindow::keyevent     > send to pane UP key=Control mods=CTRL

Anything else?

No response

@Felixoid Felixoid added the bug Something isn't working label Dec 7, 2022
@Felixoid Felixoid changed the title CTRL modifi CTRL modifiers don't work on non-latin layouts Dec 7, 2022
@Felixoid
Copy link
Author

Felixoid commented Dec 9, 2022

Dear @wez, is there anything I could add here to clarify the problematic code? I've tried to dig into the code, but I have zero experience with rust, unfortunately

@Felixoid
Copy link
Author

Felixoid commented Jan 8, 2023

Dear @wez, happy New Year!

Have you had a chance to take a look at the issue?

@wez wez added keyboard Keyboard mapping/handling Wayland labels Jan 9, 2023
@wez
Copy link
Owner

wez commented Jan 9, 2023

Hi! Sorry, I haven't been able to get to this yet.
Have you tried setting use_ime = false?

The behavior you're describing sounds similar to AltGr processing on Windows, but with the Ctrl key instead of the Alt key in the RU layout.

Perhaps there is a need for something like send_composed_key_when_left_alt_is_pressed
as described in https://wezfurlong.org/wezterm/config/keyboard-concepts.html#macos-left-and-right-option-key but for the CTRL key?

@wez wez added the waiting-on-op Waiting for more information from the original poster label Jan 9, 2023
@Felixoid
Copy link
Author

Felixoid commented Jan 9, 2023

I've tried the config, it behaves the same way:

$ wezterm --config debug_key_events=true --config use_ime=true
11:27:59.277  INFO   wezterm_gui::termwindow::keyevent > key_event RawKeyEvent { key: Physical(LeftControl), modifiers: NONE, phys_code: Some(LeftControl), raw_code: 37, repeat_count: 1, key_is_down: true, handled: Handled(false) } 
11:27:59.278  INFO   wezterm_gui::termwindow::keyevent > key_event KeyEvent { key: Control, modifiers: NONE, repeat_count: 1, key_is_down: true, raw: Some(RawKeyEvent { key: Physical(LeftControl), modifiers: NONE, phys_code: Some(LeftControl), raw_code: 37, repeat_count: 1, key_is_down: true, handled: Handled(false) }) } 
11:27:59.278  INFO   wezterm_gui::termwindow::keyevent > send to pane DOWN key=Control mods=NONE
11:28:00.198  INFO   wezterm_gui::termwindow::keyevent > key_event RawKeyEvent { key: Physical(C), modifiers: CTRL, phys_code: Some(C), raw_code: 54, repeat_count: 1, key_is_down: true, handled: Handled(false) } 
11:28:00.198  INFO   wezterm_gui::termwindow::keyevent > key_event KeyEvent { key: Char('c'), modifiers: CTRL, repeat_count: 1, key_is_down: true, raw: Some(RawKeyEvent { key: Physical(C), modifiers: CTRL, phys_code: Some(C), raw_code: 54, repeat_count: 1, key_is_down: true, handled: Handled(false) }) } 
11:28:00.198  INFO   wezterm_gui::termwindow::keyevent > send to pane DOWN key=Char('c') mods=CTRL
11:28:00.198  INFO   wezterm_term::terminalstate::keyboard > key_down: sending "\u{3}", Char('c') CTRL
11:28:00.282  INFO   wezterm_gui::termwindow::keyevent     > key_event KeyEvent { key: Char('c'), modifiers: CTRL, repeat_count: 1, key_is_down: false, raw: Some(RawKeyEvent { key: Physical(C), modifiers: CTRL, phys_code: Some(C), raw_code: 54, repeat_count: 1, key_is_down: false, handled: Handled(false) }) } 
11:28:00.282  INFO   wezterm_gui::termwindow::keyevent     > send to pane UP key=Char('c') mods=CTRL
11:28:00.732  INFO   wezterm_gui::termwindow::keyevent     > key_event KeyEvent { key: Control, modifiers: CTRL, repeat_count: 1, key_is_down: false, raw: Some(RawKeyEvent { key: Physical(LeftControl), modifiers: CTRL, phys_code: Some(LeftControl), raw_code: 37, repeat_count: 1, key_is_down: false, handled: Handled(false) }) } 
11:28:00.732  INFO   wezterm_gui::termwindow::keyevent     > send to pane UP key=Control mods=CTRL
11:28:01.436  INFO   wezterm_gui::termwindow::keyevent     > key_event RawKeyEvent { key: Physical(CapsLock), modifiers: NONE, phys_code: Some(CapsLock), raw_code: 66, repeat_count: 1, key_is_down: true, handled: Handled(false) } 
11:28:02.363  INFO   wezterm_gui::termwindow::keyevent     > key_event RawKeyEvent { key: Physical(LeftControl), modifiers: NONE, phys_code: Some(LeftControl), raw_code: 37, repeat_count: 1, key_is_down: true, handled: Handled(false) } 
11:28:02.363  INFO   wezterm_gui::termwindow::keyevent     > key_event KeyEvent { key: Control, modifiers: NONE, repeat_count: 1, key_is_down: true, raw: Some(RawKeyEvent { key: Physical(LeftControl), modifiers: NONE, phys_code: Some(LeftControl), raw_code: 37, repeat_count: 1, key_is_down: true, handled: Handled(false) }) } 
11:28:02.363  INFO   wezterm_gui::termwindow::keyevent     > send to pane DOWN key=Control mods=NONE
11:28:02.729  INFO   wezterm_gui::termwindow::keyevent     > key_event RawKeyEvent { key: Physical(C), modifiers: CTRL, phys_code: Some(C), raw_code: 54, repeat_count: 1, key_is_down: true, handled: Handled(false) } 
11:28:02.729  INFO   wezterm_gui::termwindow::keyevent     > key_event KeyEvent { key: Char('с'), modifiers: CTRL, repeat_count: 1, key_is_down: true, raw: Some(RawKeyEvent { key: Physical(C), modifiers: CTRL, phys_code: Some(C), raw_code: 54, repeat_count: 1, key_is_down: true, handled: Handled(false) }) } 
11:28:02.729  INFO   wezterm_gui::termwindow::keyevent     > send to pane DOWN key=Char('с') mods=CTRL
11:28:02.729  INFO   wezterm_term::terminalstate::keyboard > key_down: sending "с", Char('с') CTRL
11:28:02.807  INFO   wezterm_gui::termwindow::keyevent     > key_event KeyEvent { key: Char('с'), modifiers: CTRL, repeat_count: 1, key_is_down: false, raw: Some(RawKeyEvent { key: Physical(C), modifiers: CTRL, phys_code: Some(C), raw_code: 54, repeat_count: 1, key_is_down: false, handled: Handled(false) }) } 
11:28:02.807  INFO   wezterm_gui::termwindow::keyevent     > send to pane UP key=Char('с') mods=CTRL
11:28:03.668  INFO   wezterm_gui::termwindow::keyevent     > key_event KeyEvent { key: Control, modifiers: CTRL, repeat_count: 1, key_is_down: false, raw: Some(RawKeyEvent { key: Physical(LeftControl), modifiers: CTRL, phys_code: Some(LeftControl), raw_code: 37, repeat_count: 1, key_is_down: false, handled: Handled(false) }) } 
11:28:03.668  INFO   wezterm_gui::termwindow::keyevent     > send to pane UP key=Control mods=CTRL
11:28:08.520  INFO   wezterm_gui::termwindow::keyevent     > key_event RawKeyEvent { key: Physical(CapsLock), modifiers: NONE, phys_code: Some(CapsLock), raw_code: 66, repeat_count: 1, key_is_down: true, handled: Handled(false) } 
11:28:09.016  INFO   wezterm_gui::termwindow::keyevent     > key_event RawKeyEvent { key: Physical(LeftControl), modifiers: NONE, phys_code: Some(LeftControl), raw_code: 37, repeat_count: 1, key_is_down: true, handled: Handled(false) } 
11:28:09.016  INFO   wezterm_gui::termwindow::keyevent     > key_event KeyEvent { key: Control, modifiers: NONE, repeat_count: 1, key_is_down: true, raw: Some(RawKeyEvent { key: Physical(LeftControl), modifiers: NONE, phys_code: Some(LeftControl), raw_code: 37, repeat_count: 1, key_is_down: true, handled: Handled(false) }) } 
11:28:09.016  INFO   wezterm_gui::termwindow::keyevent     > send to pane DOWN key=Control mods=NONE
11:28:09.536  INFO   wezterm_gui::termwindow::keyevent     > key_event RawKeyEvent { key: Physical(C), modifiers: CTRL, phys_code: Some(C), raw_code: 54, repeat_count: 1, key_is_down: true, handled: Handled(false) } 
11:28:09.536  INFO   wezterm_gui::termwindow::keyevent     > key_event KeyEvent { key: Char('c'), modifiers: CTRL, repeat_count: 1, key_is_down: true, raw: Some(RawKeyEvent { key: Physical(C), modifiers: CTRL, phys_code: Some(C), raw_code: 54, repeat_count: 1, key_is_down: true, handled: Handled(false) }) } 
11:28:09.536  INFO   wezterm_gui::termwindow::keyevent     > send to pane DOWN key=Char('c') mods=CTRL
11:28:09.536  INFO   wezterm_term::terminalstate::keyboard > key_down: sending "\u{3}", Char('c') CTRL
11:28:09.583  INFO   wezterm_gui::termwindow::keyevent     > key_event KeyEvent { key: Char('c'), modifiers: CTRL, repeat_count: 1, key_is_down: false, raw: Some(RawKeyEvent { key: Physical(C), modifiers: CTRL, phys_code: Some(C), raw_code: 54, repeat_count: 1, key_is_down: false, handled: Handled(false) }) } 
11:28:09.583  INFO   wezterm_gui::termwindow::keyevent     > send to pane UP key=Char('c') mods=CTRL
11:28:09.739  INFO   wezterm_gui::termwindow::keyevent     > key_event RawKeyEvent { key: Physical(D), modifiers: CTRL, phys_code: Some(D), raw_code: 40, repeat_count: 1, key_is_down: true, handled: Handled(false) } 
11:28:09.739  INFO   wezterm_gui::termwindow::keyevent     > key_event KeyEvent { key: Char('d'), modifiers: CTRL, repeat_count: 1, key_is_down: true, raw: Some(RawKeyEvent { key: Physical(D), modifiers: CTRL, phys_code: Some(D), raw_code: 40, repeat_count: 1, key_is_down: true, handled: Handled(false) }) } 
11:28:09.739  INFO   wezterm_gui::termwindow::keyevent     > send to pane DOWN key=Char('d') mods=CTRL
11:28:09.739  INFO   wezterm_term::terminalstate::keyboard > key_down: sending "\u{4}", Char('d') CTRL
$ wezterm -V                                         
wezterm 20221119-145034-49b9839f

@github-actions github-actions bot removed the waiting-on-op Waiting for more information from the original poster label Jan 9, 2023
@wez wez added the X11 label Jan 11, 2023
@gagbo

This comment was marked as off-topic.

@wez
Copy link
Owner

wez commented Jan 19, 2023

@gagbo this specific issue is tracking something that applies only to X11/Wayland. I think you're experiencing this macOS issue:

@Ernest0x
Copy link

Ernest0x commented Feb 3, 2023

My experience with the Greek layout keyboard in KDE is that WezTerm's shortcuts with Ctrl + Shift + Alt modifiers are working if the left-side modifier keys are pressed (LeftCtrl + LeftShift + LeftAlt) and not working if the right-side modifier keys are pressed (RightCtrl + RightShift + RightAlt). This happens even with the system-level shortcut for keyboard layout change disabled (so, it could be unrelated to the issue #3010 I had opened before).

@Felixoid
Copy link
Author

Hello, another kind reminder about the issue. Just checked, it's the same behavior on version 20230408-112425-69ae8472

wez added a commit that referenced this issue Apr 19, 2023
For eg: RU layout, CTRL-S shouldn't result in ы in the context
of a terminal.

The approach taken here is similar to kitty; when the key combination
doesn't produce a definitive composed output, and when any of
ctrl/alt/super are present, we treat the keypress as though it were
the same as the one from the system default keymap.

The result is that ctrl-c now works like ctrl-c and alt-b and alt-f work
like their latin counterparts.

Hopefully there are no downsides to this!

refs: #2845
refs: kovidgoyal/kitty#606
@wez
Copy link
Owner

wez commented Apr 19, 2023

@Felixoid I just pushed a commit to main that seems to help here. It works similarly to the way that kitty handled its equivalent issue:

@wez wez added the fixed-in-nightly This is (or is assumed to be) fixed in the nightly builds. label Apr 19, 2023
@Felixoid
Copy link
Author

Yay, it looks solved to me!

> wezterm --config debug_key_events=true --config use_ime=false
xkbcommon: ERROR: /home/felixoid/.XCompose:4:13: unrecognized keysym "_" on left-hand side
20:01:34.432  INFO   wezterm_gui::termwindow::keyevent > key_event KeyEvent { key: Char('\r'), modifiers: NONE, leds: NUM_LOCK, repeat_count: 1, key_is_down: false, raw: Some(RawKeyEvent { key: Physical(Return), modifiers: NONE, leds: NUM_LOCK, phys_code: Some(Return), raw_code: 36, repeat_count: 1, key_is_down: false, handled: Handled(false) }) } 
20:01:34.432  INFO   wezterm_gui::termwindow::keyevent > send to pane UP key=Enter mods=NONE
20:01:36.197  INFO   wezterm_gui::termwindow::keyevent > key_event RawKeyEvent { key: Physical(D), modifiers: NONE, leds: NUM_LOCK, phys_code: Some(D), raw_code: 40, repeat_count: 1, key_is_down: true, handled: Handled(false) } 
20:01:36.197  INFO   wezterm_gui::termwindow::keyevent > key_event KeyEvent { key: Char('в'), modifiers: NONE, leds: NUM_LOCK, repeat_count: 1, key_is_down: true, raw: Some(RawKeyEvent { key: Physical(D), modifiers: NONE, leds: NUM_LOCK, phys_code: Some(D), raw_code: 40, repeat_count: 1, key_is_down: true, handled: Handled(false) }) } 
20:01:36.197  INFO   wezterm_gui::termwindow::keyevent > send to pane DOWN key=Char('в') mods=NONE
20:01:36.197  INFO   wezterm_term::terminalstate::keyboard > key_down: sending "в", Char('в') NONE
20:01:36.311  INFO   wezterm_gui::termwindow::keyevent     > key_event KeyEvent { key: Char('в'), modifiers: NONE, leds: NUM_LOCK, repeat_count: 1, key_is_down: false, raw: Some(RawKeyEvent { key: Physical(D), modifiers: NONE, leds: NUM_LOCK, phys_code: Some(D), raw_code: 40, repeat_count: 1, key_is_down: false, handled: Handled(false) }) } 
20:01:36.311  INFO   wezterm_gui::termwindow::keyevent     > send to pane UP key=Char('в') mods=NONE
20:01:36.510  INFO   wezterm_gui::termwindow::keyevent     > key_event RawKeyEvent { key: Physical(S), modifiers: NONE, leds: NUM_LOCK, phys_code: Some(S), raw_code: 39, repeat_count: 1, key_is_down: true, handled: Handled(false) } 
20:01:36.510  INFO   wezterm_gui::termwindow::keyevent     > key_event KeyEvent { key: Char('ы'), modifiers: NONE, leds: NUM_LOCK, repeat_count: 1, key_is_down: true, raw: Some(RawKeyEvent { key: Physical(S), modifiers: NONE, leds: NUM_LOCK, phys_code: Some(S), raw_code: 39, repeat_count: 1, key_is_down: true, handled: Handled(false) }) } 
20:01:36.510  INFO   wezterm_gui::termwindow::keyevent     > send to pane DOWN key=Char('ы') mods=NONE
20:01:36.510  INFO   wezterm_term::terminalstate::keyboard > key_down: sending "ы", Char('ы') NONE
20:01:36.612  INFO   wezterm_gui::termwindow::keyevent     > key_event KeyEvent { key: Char('ы'), modifiers: NONE, leds: NUM_LOCK, repeat_count: 1, key_is_down: false, raw: Some(RawKeyEvent { key: Physical(S), modifiers: NONE, leds: NUM_LOCK, phys_code: Some(S), raw_code: 39, repeat_count: 1, key_is_down: false, handled: Handled(false) }) } 
20:01:36.612  INFO   wezterm_gui::termwindow::keyevent     > send to pane UP key=Char('ы') mods=NONE
20:01:37.471  INFO   wezterm_gui::termwindow::keyevent     > key_event RawKeyEvent { key: Physical(LeftControl), modifiers: NONE, leds: NUM_LOCK, phys_code: Some(LeftControl), raw_code: 37, repeat_count: 1, key_is_down: true, handled: Handled(false) } 
20:01:37.471  INFO   wezterm_gui::termwindow::keyevent     > key_event KeyEvent { key: LeftControl, modifiers: NONE, leds: NUM_LOCK, repeat_count: 1, key_is_down: true, raw: Some(RawKeyEvent { key: Physical(LeftControl), modifiers: NONE, leds: NUM_LOCK, phys_code: Some(LeftControl), raw_code: 37, repeat_count: 1, key_is_down: true, handled: Handled(false) }) } 
20:01:37.471  INFO   wezterm_gui::termwindow::keyevent     > send to pane DOWN key=LeftControl mods=NONE
20:01:37.877  INFO   wezterm_gui::termwindow::keyevent     > key_event RawKeyEvent { key: Physical(C), modifiers: CTRL, leds: NUM_LOCK, phys_code: Some(C), raw_code: 54, repeat_count: 1, key_is_down: true, handled: Handled(false) } 
20:01:37.877  INFO   wezterm_gui::termwindow::keyevent     > key_event KeyEvent { key: Char('c'), modifiers: CTRL, leds: NUM_LOCK, repeat_count: 1, key_is_down: true, raw: Some(RawKeyEvent { key: Physical(C), modifiers: CTRL, leds: NUM_LOCK, phys_code: Some(C), raw_code: 54, repeat_count: 1, key_is_down: true, handled: Handled(false) }) } 
20:01:37.877  INFO   wezterm_gui::termwindow::keyevent     > send to pane DOWN key=Char('c') mods=CTRL
20:01:37.877  INFO   wezterm_term::terminalstate::keyboard > key_down: sending "\u{3}", Char('c') CTRL
20:01:37.943  INFO   wezterm_gui::termwindow::keyevent     > key_event KeyEvent { key: Char('с'), modifiers: CTRL, leds: NUM_LOCK, repeat_count: 1, key_is_down: false, raw: Some(RawKeyEvent { key: Physical(C), modifiers: CTRL, leds: NUM_LOCK, phys_code: Some(C), raw_code: 54, repeat_count: 1, key_is_down: false, handled: Handled(false) }) } 
20:01:37.943  INFO   wezterm_gui::termwindow::keyevent     > send to pane UP key=Char('с') mods=CTRL
20:01:38.931  INFO   wezterm_gui::termwindow::keyevent     > key_event RawKeyEvent { key: Physical(D), modifiers: CTRL, leds: NUM_LOCK, phys_code: Some(D), raw_code: 40, repeat_count: 1, key_is_down: true, handled: Handled(false) } 
20:01:38.931  INFO   wezterm_gui::termwindow::keyevent     > key_event KeyEvent { key: Char('d'), modifiers: CTRL, leds: NUM_LOCK, repeat_count: 1, key_is_down: true, raw: Some(RawKeyEvent { key: Physical(D), modifiers: CTRL, leds: NUM_LOCK, phys_code: Some(D), raw_code: 40, repeat_count: 1, key_is_down: true, handled: Handled(false) }) } 
20:01:38.931  INFO   wezterm_gui::termwindow::keyevent     > send to pane DOWN key=Char('d') mods=CTRL
20:01:38.931  INFO   wezterm_term::terminalstate::keyboard > key_down: sending "\u{4}", Char('d') CTRL

@Ernest0x
Copy link

@wez the commit didn't solve the case I had mentioned above about (LeftCtrl + LeftShift + LeftAlt) working but (RightCtrl + RightShift + RightAlt) not working in greek layout. This happens because in greek layout there is a distinction between Alt and AltGr, and the LeftAlt is registered as Alt while the RightAlt is registered as AltGr. So, for example, in greek layout, the shortcut for horizontal split is not working when pressing (RightCtrl + RightShift + RightAlt + %), whereas it is working when pressing (RightCtrl + RightShift + LeftAlt + %).

I am not sure if your recent patch was expected to also catch this case with Alt vs AltGr or if it was only to help with the shortcuts such as (Ctrl + d) in different layouts. In any case, I confirm myself too that, with this patch, (Ctrl +d) now works with the greek layout. So, thank you for this improvement at least!

@wez
Copy link
Owner

wez commented Apr 20, 2023

@Ernest0x that sounds like a separate issue to me. On macOS we have some options that control when we route keys via the IME/composition layer: https://wezfurlong.org/wezterm/config/keyboard-concepts.html#macos-left-and-right-option-key it sounds like perhaps this same concept should be introduced to X11/Wayland. Please open a separate issue to track that!

@Ernest0x
Copy link

@wez thanks, I have opened #3578 to track this.

@olaf-rogalsky
Copy link

Now, after the recent commit, pressing Ctrl-Z gives the ascii character ^Y and Ctrl-Y gives ^Z. This is because in the german keyboard layout (among other differences) the keys for Y and Z are swapped.

ctrl-shortcuts should work by Phisical(S) and not Char('ы')
I tend to disagree and think, that Ctrl-characters should work by Char(.), so that Ctrl keypresses reflect what a user visually sees on the keycaps of his keyboard and not what he would see, if he had an US keyboard. All other terminal emulators which I know of work on the Char(.). E.g. with Xterm I even can produce the escape character by pressing Ctrl-AltGr-8, where AltGr-8 alone produces the character "[".

wez added a commit that referenced this issue Jul 9, 2023
This is fixing a regression introduced by the fix for #2845.
The resolution for this is relatively straightforward, but took a bit
of effort to plumb.

Previously:
* CTRL/ALT/SUPER-modified keys with no explicit expansion would end
  up just taking the US layout version of the key.  That worked well
  for the intended problem with non-latin layouts, but for eg: German
  layouts it caused expansion to totally the wrong thing

Now:
* CTRL/ALT/SUPER-modified keys which effectively expand to non-ascii
  text (eg: cyrillic "Es") now take the equivalent key press from the
  US layout (which would be "c" in the "Es" case).  For European
  layouts this heuristic seems to avoid unexpected effects, but could
  do with some validation from native users.

To support this, the xkb code splits the `Keyboard` struct out from
some of the higher level logic and introduces a `KeyboardWithFallback`
struct that is built out of the user-selected keyboard layout, and
the fallback keyboard.  Now the fallback keyboard is fed the same
key inputs as the selected keyboard to correctly model the key
combinations.

refs: #3610
refs: #3933
@wez
Copy link
Owner

wez commented Jul 9, 2023

@olaf-rogalsky see #3610

@Felixoid
Copy link
Author

Felixoid commented Jul 9, 2023

should we close the issue as solved? I think so, unless there's some hidden part

@Felixoid Felixoid closed this as completed Jul 9, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Aug 9, 2023

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 9, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working fixed-in-nightly This is (or is assumed to be) fixed in the nightly builds. keyboard Keyboard mapping/handling Wayland X11
Projects
None yet
Development

No branches or pull requests

5 participants