How can I get hs.hotkey.bind to work when VMWare Horizon Client has focus?

11 views Asked by At

I've created a Hammerspoon script that creates and sends keyboard events when a hotkey is pressed. No matter what I bind it to, the function does not run when VMWare Horizon Client has focus. I think Horizon Client is trying to capture keyboard events directly and forward them remote desktop, so it may be using an API that is not common for MacOS apps that prevents the keybinding from working. Any advice would be welcome.

local obj = {
}

-- Metadata
obj.name = "Test"
obj.version = "1.0"
obj.author = "Chad Skeeters"


function obj:SendKeys()
    print("SendKeys Function Called")
    hs.eventtap.keyStrokes("test")
end

function obj:init()
    local mash = { 'ctrl', 'alt', 'cmd' }

    hs.hotkey.bind(mash, 'j', function() obj:SendKeys() end)
end

return obj
0

There are 0 answers