From 79d7567a1d879fb06fb4484f7984a6f87f7affbd Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Thu, 28 Jun 2018 15:36:53 +0200 Subject: [PATCH] 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 --- objects/screen.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/objects/screen.c b/objects/screen.c index 7b0d02192..62e6479c0 100644 --- a/objects/screen.c +++ b/objects/screen.c @@ -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);