From e2c6c45a2636b24b7efd1dacd2227689a0fe08c6 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Tue, 16 Nov 2021 16:09:18 +0100 Subject: rc/workspace: handle screen removal cleanly --- rc.lua | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'rc.lua') diff --git a/rc.lua b/rc.lua index 9ff61ce..c72747a 100644 --- a/rc.lua +++ b/rc.lua @@ -79,7 +79,7 @@ mypromptbox = {} local wsp = workspace.Workspace:new(layouts) awful.screen.connect_for_each_screen(function(s) - print('connected screen') + print('Setting up screen:') for k, v in pairs(s.outputs) do print(k) end @@ -126,6 +126,13 @@ awful.screen.connect_for_each_screen(function(s) mywibox[s] = awful.wibar({ position = "right", screen = s, width = panel_width }) mywibox[s]:set_widget(layout) + -- clean up on screen removal + s:connect_signal("removed", + function (s) + mywibox[s] = nil + mypromptbox[s] = nil + end) + -- show desktop on th screen gears.timer.delayed_call(function(s) wsp:view(s, s.index, 1) end, s) end) -- cgit v1.2.3