-
Notifications
You must be signed in to change notification settings - Fork 0
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
non-recursive mappings ? #2
Comments
Sending keystrokes like this is something I'd eventually like to support directly in lucky which would hopefully be done in a way that would circumvent these issues entirely, but for now there should still be a way to work around it using filters. For example: local firefox_ctrl_x = false
lucky.bind('ctrl+x', {
filter = function(wid)
return lucky.get_class(wid) == "firefox"
end,
press = function()
firefox_ctrl_x = true
lucky.cmd('xdotool', 'key', '--clearmodifiers', 'ctrl+w')
end
})
lucky.bind('ctrl+w', {
filter = function(wid)
if firefox_ctrl_x then
firefox_ctrl_x = false
return false
end
return lucky.get_class(wid) == "firefox"
end,
press = function()
lucky.cmd('xdotool', 'key', '--clearmodifiers', 'ctrl+Backspace')
end
}) If you run into any issues with this approach let me know, I haven't tested this example myself. |
This works, thanks!
…On Wed, Oct 4, 2023 at 3:17 PM Boo ***@***.***> wrote:
Sending keystrokes like this is something I'd eventually like to support
directly in lucky which would hopefully be done in a way that would
circumvent these issues entirely, but for now there should still be a way
to work around it using filters. For example:
local firefox_ctrl_x = false
lucky.bind('ctrl+x', {
filter = function(wid)
return lucky.get_class(wid) == "firefox"
end,
press = function()
firefox_ctrl_x = true
lucky.cmd('xdotool', 'key', '--clearmodifiers', 'ctrl+w')
end
})
lucky.bind('ctrl+w', {
filter = function(wid)
if firefox_ctrl_x then
firefox_ctrl_x = false
return false
end
return lucky.get_class(wid) == "firefox"
end,
press = function()
lucky.cmd('xdotool', 'key', '--clearmodifiers', 'ctrl+Backspace')
end
})
If you run into any issues with this approach let me know, I haven't
tested this example myself.
—
Reply to this email directly, view it on GitHub
<#2 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AOACPEOWAPJCKX2OTXHACK3X5WY3ZAVCNFSM6AAAAAA5S6VAXCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONBXGQ4TGMJRGY>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
First of all, I do appreciate the work you've put in for lucky, I believe it has great potential.
I would like to map ctrl+w to ctrl+Backspace in Firefox (which I can do right now), but I would like to map ctrl+x to ctrl+w in Firefox, in order to close the current tab. This I cannot do right now, since If I'm doing
lucky.cmd('xdotool', 'key', '--clearmodifiers', 'ctrl+w')
, then lucky intercepts that, and I'm stuck in an infinite loop. How can I get out of it?The text was updated successfully, but these errors were encountered: