Skip to content

Instantly share code, notes, and snippets.

@al3xandru
Created August 23, 2017 05:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save al3xandru/12bf2808a147378e781d5f25227aebfb to your computer and use it in GitHub Desktop.
Save al3xandru/12bf2808a147378e781d5f25227aebfb to your computer and use it in GitHub Desktop.
Using screen function in hs.layout results in "Unable to find display: function: 0x60800084a3b0"
layout = {
{"Mail", nil, function() attemptSecondaryScreen() end, hs.geometry.unitrect(0, 0, 1, 0.7), nil, nil},
{"Slack", nil, attemptSecondaryScreen, hs.geometry.unitrect(0, 0.3, 1, 0.7), nil, nil}
}
function attemptSecondaryScreen()
local screens = hs.screen.allScreens()
if #screens > 1 then
for _, scr in ipairs(screens) do
if scr ~= hs.screen.primaryScreen() then
return scr
end
end
end
return hs.screen.primaryScreen()
end
@al3xandru
Copy link
Author

Answer: attemptSecondaryScreen() must appear as a call in the definition. Not as a reference to a function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment