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

RecursiveBinder doesn't reset if you press trigger key while a modal is already open #332

Open
saml-dev opened this issue Mar 8, 2025 · 0 comments · May be fixed by #333
Open

RecursiveBinder doesn't reset if you press trigger key while a modal is already open #332

saml-dev opened this issue Mar 8, 2025 · 0 comments · May be fixed by #333

Comments

@saml-dev
Copy link

saml-dev commented Mar 8, 2025

I would expect pressing the trigger key to cancel any in-progress modal, but it doesn't. It hides the UI, but is still listening for keypresses.

Here is a minimal reproduction:

hs.loadSpoon("RecursiveBinder")
local singleKey = spoon.RecursiveBinder.singleKey

local keyMap = {
    [singleKey("l", "links")] = {
        [singleKey("g", "google")] = function() hs.execute("open https://google.com") end
    },
    [singleKey("a", "apple")] = function() hs.execute("open https://apple.com") end
}

hs.hotkey.bind({ "cmd" }, "j", spoon.RecursiveBinder.recursiveBind(keyMap))

Using this as your config, you can see the unexpected behavior by using this sequence of key presses

cmd j        -- triggers the modal
l                -- opens the "links" groups
cmd j        -- reset the modal back to the root
a               -- opens apple.com in the browser, closing the modal UI, signals to user that it's not listening
g               -- opens google.com in the browser because the first modal was still listening for keypresses

The workaround is to press escape before starting a new modal, but I have a fix for this bug. I'll open a PR right after posting this issue.

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

Successfully merging a pull request may close this issue.

1 participant