reconcile normalizing SHIFT modifier in key events on X11
What Operating System(s) are you seeing this problem on?
Linux X11
WezTerm version
26500c675f8be1ee59db7018a2855b87d1b38a9a
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
On version 20220101-133340-7edc5b5a I used to have a keybinding like this:
return {
leader = { key='\\', mods="CTRL", timeout_milliseconds=1000 },
keys = {
{key="|", mods="LEADER", action=wezterm.action{SplitHorizontal={domain="CurrentPaneDomain"}}},
},
}
This was working as expected. I am now using version 20220319-142410-0fcdea07 where this no longer works and instead I need to use:
return {
leader = { key='\\', mods="CTRL", timeout_milliseconds=1000 },
keys = {
{key="\\", mods="LEADER|SHIFT", action=wezterm.action{SplitHorizontal={domain="CurrentPaneDomain"}}},
},
}
After building latest main (see version on the top of this form) I noticed that neither of those keybindings appear to work any more so the situation actually got worse.
To Reproduce
- Add the above leader and keybind
- Try the keybinding for splitting horizontally
- Observe that it does not work
Configuration
local wezterm = require'wezterm'
return {
leader = { key='\\', mods="CTRL", timeout_milliseconds=1000 },
keys = {
-- neither of these work:
{key="\\", mods="LEADER|SHIFT", action=wezterm.action{SplitHorizontal={domain="CurrentPaneDomain"}}},
{key="|", mods="LEADER", action=wezterm.action{SplitHorizontal={domain="CurrentPaneDomain"}}},
},
}
Expected Behavior
The splitting should work normally as before.
Logs
Nothing happens here.
Anything else?
No response
FWIW, this works for me:
local wezterm = require 'wezterm';
-- This is helpful when debugging leader states
wezterm.on("update-right-status", function(window, pane)
local leader = ""
if window:leader_is_active() then
leader = "LEADER"
end
window:set_right_status(leader)
end);
return {
debug_key_events = true,
leader = { key='\\', mods="CTRL", timeout_milliseconds=1000 },
keys = {
{key="|", mods="LEADER|SHIFT", action=wezterm.action{SplitHorizontal={domain="CurrentPaneDomain"}}},
},
colors = {
-- this also helps to indicate leader states
compose_cursor = "orange",
},
}
the background around this is a bit thorny; wezterm traditionally needed to include SHIFT in the modifiers, but in a recent release, moved to defaulting to physical mapping where it turned out not to be needed. That default was flipped back in the latest release, making them required again.
What I'd like to be possible is for wezterm to be able to know whether the SHIFT modifier state is already factored into the resultant key text and strip it out of the key event objects. It's challening to do this consistently across the different platforms, so it hasn't happened yet!
Interesting, thanks! I guess I will update all my mappings which rely on the a shifted character in that case.
Do you want to leave this open to track the "infer SHIFT modifier from character value" or do you want to close this?
Let's keep this open for now!