-
Notifications
You must be signed in to change notification settings - Fork 574
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
EventTap seems to be sending the event to the wrong window #1334
Comments
Anyone available to help? |
Rather than modify the event you receive in your eventtap callback, try creating a new |
@cmsj Thanks a lot for the suggestion! Unfortunately it doesn't seem to work Here's the updated config local anneEt = hs.eventtap.new({ hs.eventtap.event.types.keyDown }, function(event)
local kc = event:getKeyCode()
local mapped = capsMap[inverseKeycodes[kc]]
if mapped ~= nil then
key = event:getKeyCode()
mods = event:getFlags()
if mapped.key ~= nil then
key = hs.keycodes.map[mapped.key]
end
if mapped.mods ~= nil then
for _, m in pairs(mapped.mods) do
mods[m] = true
end
end
return true, {hs.eventtap.event.newKeyEvent(mods, key, true)}
end
return false
end) |
@shivawu same symptoms as before? :( |
Yeah... Could you try the same config with "F13" replaced by things like "Caps", should work the same way, right? |
It's a bit hard to describe, I'll try my best. Not sure if this is the right place to ask, because I don't know if it's a bug or I'm doing anything wrong with my config. So sorry in advance for spamming.
What I did is, I want CapsLock key to be a hybrid Ctrl/Function key on my new keyboard, for example:
caps+B
acts likectrl+B
caps+i
acts like up arrowYou get the idea.
My approach is to use an eventTap that's activated when Caps is pressed, and stopped when it's released, the event tap watches keydown event and translate it.
The reason I didn't use modal for it is that,
The only problem I've found is,
Caps-IJKL
now are my arrow keys, if I switch a window usingCmd-Tab
, then I pressCaps-I
, it'll actually trigger aup
in the previous window. I have to type something real in the new window to make it switch. Not sure if this is a bug, or it's something I'm doing wrong in the config.Here's my config: https://gist.github.com/shivawu/a28ab3016956db601df0bba37b75546e
The text was updated successfully, but these errors were encountered: