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

hs.window.filter.focus functions no longer working on 0.9.81 #2566

Closed
fent opened this issue Oct 17, 2020 · 3 comments · Fixed by #2576
Closed

hs.window.filter.focus functions no longer working on 0.9.81 #2566

fent opened this issue Oct 17, 2020 · 3 comments · Fixed by #2576

Comments

@fent
Copy link

fent commented Oct 17, 2020

I have the following bindings in my config which no longer work with the latest version

hs.hotkey.bind({"ctrl", "shift"}, "N", hs.window.filter.focusWest)
hs.hotkey.bind({"ctrl", "shift"}, "M", hs.window.filter.focusSouth)
hs.hotkey.bind({"ctrl", "shift"}, ",", hs.window.filter.focusNorth)
hs.hotkey.bind({"ctrl", "shift"}, ".", hs.window.filter.focusEast)

nothing happens when I press the keys. changing the functions to hs.alert.show does display an alert.

I downgraded to 0.9.80, and the bindings work again

@asmagill
Copy link
Member

<Sigh>... yet another place where the past practice of mixing methods and functions within hs.window has broken things as we clean up and standardize.

See #2517 (comment) for the explanation.

I'll see about fixing hs.window.filter this weekend.

It's not meant to be a permanent fix and I make no promises that it will work in the future but you can add the following to your primary Hammerspoon config file In the mean time and your existing code should work for now.

local window = require("hs.window") -- make sure this is loaded
local winMT  = getmetatable(window)
local original_index = winMT.__index
winMT.__index = function(self, key)
    local answer = original_index(self, key)
    if answer then
        return answer
    else
        return hs.getObjectMetatable("hs.window")[key]
    end
end

@asmagill
Copy link
Member

@fent, Just a reminder, when #2576 lands and a new release is made, you should remove the above fix, if you've applied it. It won't break anything at the moment, but I can't guarantee the future.

@snarfed
Copy link

snarfed commented Dec 31, 2020

I tried building from head to get this fix, and it works great. Thank you!

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

Successfully merging a pull request may close this issue.

3 participants