Calling this function will raise error after upgraded to v0.9.79.
function send_window_next_screen()
hs.notify.show("Next Screen", "", "")
local win = hs.window.focusedWindow()
win:moveOneScreenEast(0)
end
Error in console:
2020-09-21 07:29:22: 07:29:22 ERROR: LuaSkin: hs.hotkey callback: /Users/myuser/.hammerspoon/init.lua:24: attempt to call a nil value (method 'moveOneScreenEast')
stack traceback:
/Users/myuser/.hammerspoon/init.lua:24: in function 'send_window_next_screen'
/Users/myuser/.hammerspoon/init.lua:13: in function </Users/myuser/.hammerspoon/init.lua:13>
As a workaround, I'm using hs.grid.pushWindowNextScreen, and it's still working as of 0.9.79
function send_window_next_screen()
hs.notify.show("Next Screen", "", "")
local win = hs.window.focusedWindow()
hs.grid.pushWindowNextScreen(win)
end
Another possible workaround is to calculate the screen separately and then send to it: https://github.com/mirosval/dotfiles/commit/71d27175339c422153e6368af294c654bb1b93c6#diff-7f99af5084e5a4ae5d833a1c94045165
function moveWindow(where)
if hs.window.focusedWindow() then
local w = hs.window.frontmostWindow()
local s = hs.screen.mainScreen()
if (where == "east") then s = s:toEast()
elseif (where == "west") then s = s:toWest()
elseif (where == "south") then s = s:toSouth()
elseif (where == "north") then s = s:toNorth()
end
w:moveToScreen(s)
end
end
I was digging a bit through the code and it seems the moveOneScreen* functions are defined dynamically, so maybe that stoppped working.
See my comment in https://github.com/Hammerspoon/hammerspoon/issues/2480#issuecomment-696299482 for a potential fix. I'll try to get a pull up later when I have time to test it appropriately.
Just confirming the issue had been fixed in version 0.9.81 (5594). Thank you very much! 馃帄
Most helpful comment
As a workaround, I'm using
hs.grid.pushWindowNextScreen, and it's still working as of 0.9.79