This allows the PaperWM API to be called externally with a provided window. I use it with a function in my HammerSpoon config that moves all windows for a specific application to a given space.
function move_app_windows_to_space(application, index)
local windows = hs.window.filter.new(application):getWindows()
for i, window in ipairs(windows or {}) do
-- give time to process window events between moves
hs.timer.doAfter(0.1 * i, function()
PaperWM:moveWindowToSpace(index, window)
end)
end
end
This allows the PaperWM API to be called externally with a provided window. I use it with a function in my HammerSpoon config that moves all windows for a specific application to a given space.