Skip to content

Commit

Permalink
Merge pull request #53 from mogenson/keep-focus-on-window
Browse files Browse the repository at this point in the history
Try to prevent MacOS from stealing focus away to another window
  • Loading branch information
mogenson authored Oct 20, 2024
2 parents 02a9ec6 + 8acc174 commit d2c0b73
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -704,6 +704,15 @@ function PaperWM:focusWindow(direction, focused_index)

-- focus new window, windowFocused event will be emited immediately
new_focused_window:focus()

-- try to prevent MacOS from stealing focus away to another window
Timer.doAfter(Window.animationDuration, function()
if Window.focusedWindow() ~= new_focused_window then
self.logger.df("refocusing window %s", new_focused_window)
new_focused_window:focus()
end
end)

return new_focused_window
end

Expand Down

0 comments on commit d2c0b73

Please sign in to comment.