Open zen0wu opened 7 years ago
Anyone available to help?
Rather than modify the event you receive in your eventtap callback, try creating a new hs.eventtap.event
event and returning that in the table. I'm guessing here, but it's worth a shot.
@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 arrow You 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