screen_refresh(): Fake a screen when the last one is removed (#2223)

Thanks to @ewhac for the suggestion.

Fixes: https://github.com/awesomeWM/awesome/issues/2221
Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Uli Schlachter 2018-06-28 15:36:53 +02:00 committed by Daniel Hahler
parent 5d2d296e20
commit 79d7567a1d
1 changed files with 9 additions and 0 deletions

View File

@ -661,6 +661,10 @@ screen_refresh(void)
screen_deduplicate(L, &new_screens);
/* Running without any screens at all is no fun. */
if (new_screens.len == 0)
screen_scan_x11(L, &new_screens);
/* Add new screens */
foreach(new_screen, new_screens) {
bool found = false;
@ -1176,6 +1180,11 @@ luaA_screen_fake_remove(lua_State *L)
/* WTF? */
return 0;
if (globalconf.screens.len == 1) {
luaA_warn(L, "Removing last screen through fake_remove(). "
"This is a very, very, very bad idea!");
}
screen_array_take(&globalconf.screens, idx);
luaA_object_push(L, s);
screen_removed(L, -1);