Created
August 23, 2017 05:32
-
-
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"
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
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 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Answer:
attemptSecondaryScreen()
must appear as a call in the definition. Not as a reference to a function.