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

x11/wayland: CTRL-+ key assignments no longer recognized #3610

Closed
matthias-Q opened this issue Apr 24, 2023 · 12 comments
Closed

x11/wayland: CTRL-+ key assignments no longer recognized #3610

matthias-Q opened this issue Apr 24, 2023 · 12 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

Comments

@matthias-Q
Copy link

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

Linux X11

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

awesomewm

WezTerm version

wezterm 20230424-111459-de9d9bc5

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

Changing the fontsize with action.wezterm.IncreaseFontSize (decrease, reset as well) does not work anymore.

It used to work a few days ago. I usually rebuild wezterm once per week.

To Reproduce

No response

Configuration

local keys = {
    { key = "0",          mods = "CTRL",        action = wezterm.action.ResetFontSize },
    { key = "+",          mods = "CTRL",        action = wezterm.action.IncreaseFontSize },
    { key = "-",          mods = "CTRL",        action = wezterm.action.DecreaseFontSize },
}
return {
keys = keys
}

Expected Behavior

Changing fontsize should work again

Logs

Debug Overlay
wezterm version: 20230424-111459-de9d9bc5 x86_64-unknown-linux-gnu
Window Environment: X11 awesome
WebGPU: name=AMD Radeon Graphics (RADV RENOIR), device_type=IntegratedGpu, backend=Vulkan, driver=radv, driver_info=Mesa 23.0.2, vendor=4098, device=5686
Enter lua statements or expressions and hit Enter.
Press ESC or CTRL-D to exit

Anything else?

No response

@matthias-Q matthias-Q added the bug Something isn't working label Apr 24, 2023
@wez
Copy link
Owner

wez commented Apr 24, 2023

Please run through: https://wezfurlong.org/wezterm/troubleshooting.html#debugging-keyboard-related-issues
and share the debug logs from pressing those keys.

Note that the default key assignments for IncreaseFontSize and DecreaseFontSize have multiple key assignments because eg: + is often a shifted key.

$ wezterm -n show-keys --lua | grep FontSize
    { key = ')', mods = 'CTRL', action = act.ResetFontSize },
    { key = ')', mods = 'SHIFT|CTRL', action = act.ResetFontSize },
    { key = '+', mods = 'CTRL', action = act.IncreaseFontSize },
    { key = '+', mods = 'SHIFT|CTRL', action = act.IncreaseFontSize },
    { key = '-', mods = 'CTRL', action = act.DecreaseFontSize },
    { key = '-', mods = 'SHIFT|CTRL', action = act.DecreaseFontSize },
    { key = '-', mods = 'SUPER', action = act.DecreaseFontSize },
    { key = '0', mods = 'CTRL', action = act.ResetFontSize },
    { key = '0', mods = 'SHIFT|CTRL', action = act.ResetFontSize },
    { key = '0', mods = 'SUPER', action = act.ResetFontSize },
    { key = '=', mods = 'CTRL', action = act.IncreaseFontSize },
    { key = '=', mods = 'SHIFT|CTRL', action = act.IncreaseFontSize },
    { key = '=', mods = 'SUPER', action = act.IncreaseFontSize },
    { key = '_', mods = 'CTRL', action = act.DecreaseFontSize },
    { key = '_', mods = 'SHIFT|CTRL', action = act.DecreaseFontSize },

@wez wez added the waiting-on-op Waiting for more information from the original poster label Apr 24, 2023
@matthias-Q
Copy link
Author

debug_key_events = true :

07:33:08.508  INFO   wezterm_gui::termwindow::keyevent > key_event RawKeyEvent { key: Physical(LeftControl), modifiers: NONE, leds: (empty), phys_code: Some(LeftControl), raw_code: 37, repeat_count: 1, key_is_down: true, handled: Handled(false) }
07:33:08.508  INFO   wezterm_gui::termwindow::keyevent > key_event KeyEvent { key: LeftControl, modifiers: NONE, leds: (empty), repeat_count: 1, key_is_down: true, raw: Some(RawKeyEvent { key: Physical(LeftControl), modifiers: NONE, leds: (empty), phys_code: Some(LeftControl), raw_code: 37, repeat_count: 1, key_is_down: true, handled: Handled(false) }) }
07:33:08.508  INFO   wezterm_gui::termwindow::keyevent > send to pane DOWN key=LeftControl mods=NONE
07:33:08.900  INFO   wezterm_gui::termwindow::keyevent > key_event RawKeyEvent { key: Physical(K0), modifiers: CTRL, leds: (empty), phys_code: Some(K0), raw_code: 19, repeat_count: 1, key_is_down: true, handled: Handled(false) }
07:33:08.901  INFO   wezterm_gui::termwindow::keyevent > key_event KeyEvent { key: Char('0'), modifiers: CTRL, leds: (empty), repeat_count: 1, key_is_down: true, raw: Some(RawKeyEvent { key: Physical(K0), modifiers: CTRL, leds: (empty), phys_code: Some(K0), raw_code: 19, repeat_count: 1, key_is_down: true, handled: Handled(false) }) }
07:33:08.901  INFO   wezterm_gui::termwindow::keyevent > Char('0') CTRL -> perform ResetFontSize
07:33:08.965  INFO   wezterm_gui::termwindow::keyevent > key_event KeyEvent { key: Char('0'), modifiers: CTRL, leds: (empty), repeat_count: 1, key_is_down: false, raw: Some(RawKeyEvent { key: Physical(K0), modifiers: CTRL, leds: (empty), phys_code: Some(K0), raw_code: 19, repeat_count: 1, key_is_down: false, handled: Handled(false) }) }
07:33:08.965  INFO   wezterm_gui::termwindow::keyevent > send to pane UP key=Char('0') mods=CTRL
07:33:09.306  INFO   wezterm_gui::termwindow::keyevent > key_event RawKeyEvent { key: Physical(RightBracket), modifiers: CTRL, leds: (empty), phys_code: Some(RightBracket), raw_code: 35, repeat_count: 1, key_is_down: true, handled: Handled(false) }
07:33:09.306  INFO   wezterm_gui::termwindow::keyevent > key_event KeyEvent { key: Char(']'), modifiers: CTRL, leds: (empty), repeat_count: 1, key_is_down: true, raw: Some(RawKeyEvent { key: Physical(RightBracket), modifiers: CTRL, leds: (empty), phys_code: Some(RightBracket), raw_code: 35, repeat_count: 1, key_is_down: true, handled: Handled(false) }) }
07:33:09.306  INFO   wezterm_gui::termwindow::keyevent > send to pane DOWN key=Char(']') mods=CTRL
07:33:09.306  INFO   wezterm_term::terminalstate::keyboard > key_down: sending "\u{1d}", Char(']') CTRL
07:33:09.388  INFO   wezterm_gui::termwindow::keyevent     > key_event KeyEvent { key: Char('+'), modifiers: CTRL, leds: (empty), repeat_count: 1, key_is_down: false, raw: Some(RawKeyEvent { key: Physical(RightBracket), modifiers: CTRL, leds: (empty), phys_code: Some(RightBracket), raw_code: 35, repeat_count: 1, key_is_down: false, handled: Handled(false) }) }
07:33:09.388  INFO   wezterm_gui::termwindow::keyevent     > send to pane UP key=Char('+') mods=CTRL
07:33:09.664  INFO   wezterm_gui::termwindow::keyevent     > key_event RawKeyEvent { key: Physical(Slash), modifiers: CTRL, leds: (empty), phys_code: Some(Slash), raw_code: 61, repeat_count: 1, key_is_down: true, handled: Handled(false) }
07:33:09.664  INFO   wezterm_gui::termwindow::keyevent     > key_event KeyEvent { key: Char('/'), modifiers: CTRL, leds: (empty), repeat_count: 1, key_is_down: true, raw: Some(RawKeyEvent { key: Physical(Slash), modifiers: CTRL, leds: (empty), phys_code: Some(Slash), raw_code: 61, repeat_count: 1, key_is_down: true, handled: Handled(false) }) }
07:33:09.664  INFO   wezterm_gui::termwindow::keyevent     > send to pane DOWN key=Char('/') mods=CTRL
07:33:09.664  INFO   wezterm_term::terminalstate::keyboard > key_down: sending "\u{1f}", Char('/') CTRL
07:33:09.744  INFO   wezterm_gui::termwindow::keyevent     > key_event KeyEvent { key: Char('-'), modifiers: CTRL, leds: (empty), repeat_count: 1, key_is_down: false, raw: Some(RawKeyEvent { key: Physical(Slash), modifiers: CTRL, leds: (empty), phys_code: Some(Slash), raw_code: 61, repeat_count: 1, key_is_down: false, handled: Handled(false) }) }
07:33:09.744  INFO   wezterm_gui::termwindow::keyevent     > send to pane UP key=Char('-') mods=CTRL
07:33:09.858  INFO   wezterm_gui::termwindow::keyevent     > key_event KeyEvent { key: LeftControl, modifiers: CTRL, leds: (empty), repeat_count: 1, key_is_down: false, raw: Some(RawKeyEvent { key: Physical(LeftControl), modifiers: CTRL, leds: (empty), phys_code: Some(LeftControl), raw_code: 37, repeat_count: 1, key_is_down: false, handled: Handled(false) }) }
07:33:09.858  INFO   wezterm_gui::termwindow::keyevent     > send to pane UP key=LeftControl mods=CTRL
07:33:11.198  INFO   wezterm_gui::termwindow::keyevent     > key_event RawKeyEvent { key: Physical(LeftWindows), modifiers: NONE, leds: (empty), phys_code: Some(LeftWindows), raw_code: 133, repeat_count: 1, key_is_down: true, handled: Handled(false) }
07:33:11.199  INFO   wezterm_gui::termwindow::keyevent     > key_event KeyEvent { key: Super, modifiers: NONE, leds: (empty), repeat_count: 1, key_is_down: true, raw: Some(RawKeyEvent { key: Physical(LeftWindows), modifiers: NONE, leds: (empty), phys_code: Some(LeftWindows), raw_code: 133, repeat_count: 1, key_is_down: true, handled: Handled(false) }) }
07:33:11.199  INFO   wezterm_gui::termwindow::keyevent     > send to pane DOWN key=Super mods=NONE

wezterm -n show-keys --lua | grep FontSize
    { key = ')', mods = 'CTRL', action = act.ResetFontSize },
    { key = ')', mods = 'SHIFT|CTRL', action = act.ResetFontSize },
    { key = '+', mods = 'CTRL', action = act.IncreaseFontSize },
    { key = '+', mods = 'SHIFT|CTRL', action = act.IncreaseFontSize },
    { key = '-', mods = 'CTRL', action = act.DecreaseFontSize },
    { key = '-', mods = 'SHIFT|CTRL', action = act.DecreaseFontSize },
    { key = '-', mods = 'SUPER', action = act.DecreaseFontSize },
    { key = '0', mods = 'CTRL', action = act.ResetFontSize },
    { key = '0', mods = 'SHIFT|CTRL', action = act.ResetFontSize },
    { key = '0', mods = 'SUPER', action = act.ResetFontSize },
    { key = '=', mods = 'CTRL', action = act.IncreaseFontSize },
    { key = '=', mods = 'SHIFT|CTRL', action = act.IncreaseFontSize },
    { key = '=', mods = 'SUPER', action = act.IncreaseFontSize },
    { key = '_', mods = 'CTRL', action = act.DecreaseFontSize },
    { key = '_', mods = 'SHIFT|CTRL', action = act.DecreaseFontSize },

Here is my minimal config:

local wezterm = require("wezterm")
local keys = {
    { key = "0", mods = "CTRL", action = wezterm.action.ResetFontSize },
    { key = "+", mods = "CTRL", action = wezterm.action.IncreaseFontSize },
    { key = "-", mods = "CTRL", action = wezterm.action.DecreaseFontSize },
}
return {
    keys = keys,
    debug_key_events = true
}

@github-actions github-actions bot removed the waiting-on-op Waiting for more information from the original poster label Apr 25, 2023
@wez
Copy link
Owner

wez commented Apr 25, 2023

FWIW, wezterm -n show-keys --lua | grep FontSize shows the defaults. To see your own config, remove the -n option, which skips loading your config file.

07:33:09.306  INFO   wezterm_gui::termwindow::keyevent > key_event RawKeyEvent { key: Physical(RightBracket), modifiers: CTRL, leds: (empty), phys_code: Some(RightBracket), raw_code: 35, repeat_count: 1, key_is_down: true, handled: Handled(false) }
07:33:09.388  INFO   wezterm_gui::termwindow::keyevent     > key_event KeyEvent { key: Char('+'), modifiers: CTRL, leds: (empty), repeat_count: 1, key_is_down: false, raw: Some(RawKeyEvent { key: Physical(RightBracket), modifiers: CTRL, leds: (empty), phys_code: Some(RightBracket), raw_code: 35, repeat_count: 1, key_is_down: false, handled: Handled(false) }) }
07:33:09.388  INFO   wezterm_gui::termwindow::keyevent     > send to pane UP key=Char('+') mods=CTRL

Interesting. I think this is related to the changes in 21e19ca

What is your keyboard layout? DE?

@wez wez added the waiting-on-op Waiting for more information from the original poster label Apr 25, 2023
@matthias-Q
Copy link
Author

Ah, sorry. removing the -n shows the same result.
Yes, I have a German keyboard layout

 setxkbmap -print
xkb_keymap {
        xkb_keycodes  { include "evdev+aliases(qwertz)" };
        xkb_types     { include "complete"      };
        xkb_compat    { include "complete"      };
        xkb_symbols   { include "pc+de+inet(evdev)+terminate(ctrl_alt_bksp)"    };
        xkb_geometry  { include "pc(pc105)"     };
};

@github-actions github-actions bot removed the waiting-on-op Waiting for more information from the original poster label Apr 25, 2023
@matthias-Q
Copy link
Author

I just build wezterm with the commit db720bd (directly before 21e19ca) and changing the fontsize works.

@wez wez added the keyboard Keyboard mapping/handling label Apr 25, 2023
@wez wez changed the title Changing fontsize does not work x11/wayland: CTRL-+ key assignments no longer recognized Apr 25, 2023
@pdanpdan
Copy link

I would add here that VoidSymbol (in my case CapsLock) does not work anymore (in the latest 1 or 2 daily builds).
Replacing VoidSymbol with phys:CapsLock works.

@seqizz
Copy link
Sponsor

seqizz commented Jun 14, 2023

As a workaround suggestion, could you try setting the XKB_DEFAULT_LAYOUT environment variable (to "de" for your case I guess).

@matthias-Q
Copy link
Author

This workaround did not work unfortunately.

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 wez added the fixed-in-nightly This is (or is assumed to be) fixed in the nightly builds. label Jul 9, 2023
@wez
Copy link
Owner

wez commented Jul 9, 2023

This should be resolved now in main.

It typically takes about an hour before commits are available as nightly builds for all platforms. Linux builds are the fastest to build and are often available within about 20 minutes. Windows and macOS builds take a bit longer.

Please take a few moments to try out the fix and let me know how that works out. You can find the nightly downloads for your system in the wezterm installation docs.

In particular: please confirm that any/all ctrl/alt modified keys now work as you expect in the DE layout: I think I resolved this, but I'm not sure if there are some edge cases for keys that produce latin-but-not-ascii output.

If you prefer to use packages provided by your distribution or package manager of choice and don't want to replace that with a nightly download, keep in mind that you can download portable packages (eg: a .dmg file on macOS, a .zip file on Windows and an .AppImage file on Linux) that can be run without permanently installing or replacing an existing package, and can then simply be deleted once you no longer need them.

If you are eager and can build from source then you may be able to try this out more quickly.

@sarphiv
Copy link

sarphiv commented Jul 9, 2023

I've built from main and it appears to have been fixed for me. Fedora 38, x11, custom dvorak layout.

Many many thanks! I haven't updated wezterm till now because things like Ctrl+C were incorrectly remapped.

@Felixoid
Copy link

Felixoid commented Jul 9, 2023

just checked, 20230709-122834-f09992f7 didn't break the RU layout, so the #2845 seems to remain fixed

@github-actions
Copy link

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 12, 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
Projects
None yet
Development

No branches or pull requests

6 participants