-
Notifications
You must be signed in to change notification settings - Fork 593
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
after update moving windows stopped working #2517
Comments
This is a known issue, and will be fixed in the next release. In the meantime, you can build your own Hammerspoon version from the |
What specific error message(s) are you receiving? If the error is in response to |
The error message I'm getting is 2020-09-26 20:12:40: 20:12:40 ERROR: LuaSkin: hs.hotkey callback: ...mmerspoon/Spoons/WindowScreenLeftAndRight.spoon/init.lua:73: attempt to call a nil value (method 'moveOneScreenWest') |
These are indeed the exact issues address in the master branch and will be included in the new release when it is made available. In the meantime, if you wish to manually apply the necessary fixes for this issue before the next release is built, you can apply the changes outlined in /~https://github.com/Hammerspoon/hammerspoon/pull/2488/files and 7a68956 directly by editing I'm going to close this, but feel free to reopen if you think we've missed anything. |
how do I do this? |
perhaps we can create an issue so that hammer soon allows us to install whatever version we want? |
is there an issue that shows its being tracked? |
It's not clear what I need to do with that code. |
how do I test those to paste the error?
|
when is the next release coming out? |
Until a fix is released, the easiest option may be to just revert back to Hammerspoon 0.9.78. /~https://github.com/Hammerspoon/hammerspoon/releases/tag/0.9.78 I would expect a new release relatively soon - at most within a week, but it just depends on the project maintainers availability. |
Hi folks, I've just upgraded to Version 0.9.81 (5594), and I'm also having errors moving windows. Here are the errors I'm seeing:
Here's the base config I'm using for moving windows:
|
@timriley what you have in The proper fix would be not to modify the The "cleanest" simple fix, to maintain the separation described above, would be to rewrite the declaration to each of your additions to function hs.getObjectMetatable("hs.window").left(win)
... rest of function is unchanged ...
end This causes the new "method" to be added to the correct table for objects so that Another approach that might be seen as "simpler" in the sense that it requires no modifications to any of your existing functions, is to modify the local objectMT = hs.getObjectMetatable("hs.window")
local original__index = objectMT.__index
objectMT.__index = function(_, key)
return original__index[key] or hs.window[key]
end This replaces the object method lookup table with a function that checks the original table for the method name and if one isn't found, then checks the |
Thanks for the amazingly explained advice, @asmagill! FWIW I've just tried the first approach you recommended, e.g. function hs.getObjectMetatable("hs.window").left(win)
local f = win:frame()
local screen = win:screen()
local max = screen:frame()
f.x = max.x
f.y = max.y
f.w = max.w / 2
f.h = max.h
win:setFrame(f)
end But it results in this error when loading the config:
I spelunked around some of Hammerspoon's own Lua code to look for similar usages, and found this pattern, which I tried: local windowMT = hs.getObjectMetatable("hs.window")
function windowMT.left(win)
local f = win:frame()
local screen = win:screen()
local max = screen:frame()
f.x = max.x
f.y = max.y
f.w = max.w / 2
f.h = max.h
win:setFrame(f)
end And that one worked! So thanks for helping unblock me here, that was really helpful. But I'd also love to understand why one approach worked but not the other, if you happen to have a little more time. Thank you! 😄 |
Hmmm... odd, but I think I know why... it has to do with how you define your functions. For most use cases Your approach of putting the I suspect it would work if you had written Sorry for missing that nuance in syntax! |
@asmagill no worries! Thank you again for your help here, I've learnt a lot through this exchange :) |
this is still broken for me 0.9.81.. are we obliged to change our code or will there be a release that undoes the breaking change? |
version: Version 0.9.80 (5530)
config.
The text was updated successfully, but these errors were encountered: