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

Feature Request: I would like to know if a modal is in the state active #3607

Open
muescha opened this issue Feb 29, 2024 · 1 comment
Open

Comments

@muescha
Copy link
Contributor

muescha commented Feb 29, 2024

I would like to know if a modal is in the state active

local ks = hs.hotkey.modal.new(
            mod,
            key,
            description);

ks:isActive()
ks.isActive -- call value direct

I can do a workaround like this:

function hotkeybindmodal(mod, key, description, startFn, exitFn)

    local active = false

    local ks = hs.hotkey.modal.new(
            mod,
            key,
            description);

    function ks:entered()
        debugInfo("Start Modal Mode for ".. description)
        startFn()
        active = true
    end
    function ks:exited()
        active = false
        exitFn()
        debugInfo("Exit Modal Mode for ".. description)
    end

    function ks:isActive()
        return active
    end

    return ks
end

and use it:

local ks = hotkeybindmodal(
            mod,
            key,
            description);
ks:enter()
print(ks:isActive())
@muescha
Copy link
Contributor Author

muescha commented Feb 29, 2024

see:

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

1 participant