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

Add a window parameter to moveWindowToSpace() #44

Merged
merged 1 commit into from
May 10, 2024

Conversation

mogenson
Copy link
Owner

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.

```
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
```
@mogenson mogenson merged commit 2584835 into main May 10, 2024
1 check passed
@mogenson mogenson deleted the move-window-to-space-with-window branch May 10, 2024 17:36
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 this pull request may close these issues.

1 participant