screen: Add a fallback code path when --screen manual is used.
If there is no handler, then the fallback will create the screens.
This commit is contained in:
parent
758ba2537a
commit
852ff9c340
|
@ -679,6 +679,30 @@ capi.screen.connect_signal("request::wallpaper::connected", function(new_handler
|
|||
end
|
||||
end)
|
||||
|
||||
-- Create some screens when none exist. This can happen when AwesomeWM is
|
||||
-- started with `--screen off` and no handler is used.
|
||||
capi.screen.connect_signal("scanned", function()
|
||||
if capi.screen.count() == 0 then
|
||||
-- Private API to scan for screens now.
|
||||
if #capi.screen._viewports() == 0 then
|
||||
capi.screen._scan_quiet()
|
||||
end
|
||||
|
||||
local viewports = capi.screen._viewports()
|
||||
|
||||
if #viewports > 0 then
|
||||
for _, area in ipairs(viewports) do
|
||||
local geo = area.geometry
|
||||
capi.screen.fake_add(geo.x, geo.y, geo.width, geo.height)
|
||||
end
|
||||
else
|
||||
capi.screen.fake_add(0, 0, 640, 480)
|
||||
end
|
||||
|
||||
assert(capi.screen.count() > 0, "Creating screens failed")
|
||||
end
|
||||
end)
|
||||
|
||||
--- When the tag history changed.
|
||||
-- @signal tag::history::update
|
||||
|
||||
|
|
Loading…
Reference in New Issue