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

keygrabber: Shift modifier #2634

Open
alfunx opened this issue Feb 3, 2019 · 1 comment
Open

keygrabber: Shift modifier #2634

alfunx opened this issue Feb 3, 2019 · 1 comment

Comments

@alfunx
Copy link
Contributor

alfunx commented Feb 3, 2019

When setting keybindings for a keygrabber with Shift as modifier, the key must be specified in upper case as well. Consider this example:

awful.keygrabber {
    stop_key         = 'Escape',
    start_callback   = function() naughty.notify { text = "Start" } end,
    stop_callback    = function() naughty.notify { text = "Stop" } end,
    root_keybindings = { { { "Mod4" }, "g", function() end }, },
    keybindings      = {
        { { "Shift" }, "k", function() awful.client.focus.byidx(-1) end }, --doesn't work
        { { "Shift" }, "J", function() awful.client.focus.byidx( 1) end }, --works
        { {         }, "L", function() awful.client.focus.byidx( 1) end }, --doesn't work
    },
}

The first (and the third) binding won't work. However, for normal keybindings it's the other way around, the key must be specified in lower case, otherwise it won't work.

awful.key({ "Shift" }, "k", function() awful.client.focus.byidx(-1) end), --works
awful.key({ "Shift" }, "J", function() awful.client.focus.byidx( 1) end), --doesn't work
awful.key({         }, "L", function() awful.client.focus.byidx( 1) end), --doesn't work

Note that it's the same case if you add Mod4 as modifier. However, adding Control (or both Mod4+Control) as modifier makes the keygrabber behave like the global keybindings.

Those should probably be consistent. I think the way the normal keybindings are set at the moment is more intuitive, i.e. keys should be specified in lower case. Is there some limitation outside of Awesome for this? Didn't look at that code yet.

@psychon
Copy link
Member

psychon commented Feb 4, 2019

For shift this may seem obvious, but things like € are Alt-Gr + e for me and here it would be wrong to trat this as just e instead. So, I'm not really sure what the way to go here is. Perhaps just transform the resulting string to lowercase?

Is there some limitation outside of Awesome for this? Didn't look at that code yet.

The "normal keys" use just libxcb-keysyms and core-X11 protocol. The keygrabber code uses libxkbcommon and the XKB extension, thus do things "more properly". That's where the difference comes from, basically. (Feel free to search for bug reports saying that e.g. "this combination of keyboard layouts" causes problems; the reports say that the keyboard layout switch works fine in the prompt, but keybindings still use some other, old layout.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants