mobily / awesome-keys

🚀 AwesomeKeys is a plugin for Hammerspoon, that allows customizing global and app-specific key bindings.
52 stars 1 forks source link

Same key in "from" and "to" problem #5

Open alvaro-prieto opened 1 year ago

alvaro-prieto commented 1 year ago

It seems that when the same key is in the "from" and also in the "to", the output combination is wrong. My guess is that the state of the initial key is pressed, and since it has not been released yet the new key down emulation is not fired. Maybe I'm totally wrong... Can you help me to fix it?

In this sample, { "ctrl", "alt", "shift"} + d opens a new tab on Chrome. It works fine:

hs.loadSpoon("AwesomeKeys")
local keys = spoon.AwesomeKeys
hyper = { "ctrl", "alt", "shift"}
keys:remapAppKeys({
        app = "Chrome",
        keys = {                        
                { -- new tab
                from = { mods = hyper,  key = "d"}, 
                to = {mods = {"cmd"}, key = "t"}},
        }
})

However, if I switch the "from" combination to other more logical, containing the 't', then it doesn't work:

hs.loadSpoon("AwesomeKeys")
local keys = spoon.AwesomeKeys
hyper = { "ctrl", "alt", "shift"}
keys:remapAppKeys({
        app = "Chrome",
        keys = {                        
                { -- new tab
                from = { mods = hyper,  key = "t"}, 
                to = {mods = {"cmd"}, key = "t"}},
        }
})

Or for example, this code also doesn't work it the output changes from "b" to "a"

{
        app = "Code",
        keys = {
                {
                from = { mods = {},  key = "a"}, 
                to = { mods = {"shift"}, key = "b"}}  -- does not work with  key = "a"
        }
}

Any solution or advise?