Created
January 24, 2018 04:46
-
-
Save bgreenlee/77f1fbeb673eb674ed6065b189dec4d3 to your computer and use it in GitHub Desktop.
Hammerspoon function to move off-screen windows onto the main screen
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Rescue Windows | |
-- Move any windows that are off-screen onto the main screen | |
function rescueWindows() | |
local screen = hs.screen.mainScreen() | |
local screenFrame = screen:fullFrame() | |
local wins = hs.window.visibleWindows() | |
for i,win in ipairs(wins) do | |
local frame = win:frame() | |
if not frame:inside(screenFrame) then | |
win:moveToScreen(screen, true, true) | |
end | |
end | |
end | |
return rescueWindows |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In
init.lua
: