From b0e132beaffaed26df2034566c1f77b56e24cbae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Thu, 2 Jun 2022 21:26:39 +0200 Subject: [PATCH] =?UTF-8?q?module/i3:=20if=20a=20new=20workspace=20is=20cr?= =?UTF-8?q?eated,=20but=20unfocused,=20assume=20it=E2=80=99s=20not=20empty?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If a window is created on an unfocused workspace, yambar did not update the empty tag correctly. At least not for persistent workspaces. This is because yambar relies on focus events to determine a workspace's "empty" state. Since the new window, on the new workspace, isn't focused, there's no focus event, and yambar thinks the workspace is still empty. This patch changes the logic slightly; a new workspace is considered non-empty if it isn't focused (and has a non-zero node count). Closes #191 --- modules/i3.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/i3.c b/modules/i3.c index 22b6d4b..e036f97 100644 --- a/modules/i3.c +++ b/modules/i3.c @@ -139,7 +139,7 @@ workspace_from_json(const struct json_object *json, struct workspace *ws) .visible = json_object_get_boolean(visible), .focused = json_object_get_boolean(focused), .urgent = json_object_get_boolean(urgent), - .empty = is_empty, + .empty = is_empty && json_object_get_boolean(focused), .window = {.title = NULL, .pid = -1}, };