From 3dff3d8b13121e1722dd45642c27249c17f86122 Mon Sep 17 00:00:00 2001 From: Akos Horvath Date: Thu, 8 Sep 2022 13:37:13 +0200 Subject: [PATCH] show empty workspaces --- include/workspace.h | 6 ++++++ src/main.c | 1 + src/workspace.c | 20 ++++++++++++++++++-- 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/include/workspace.h b/include/workspace.h index fe6d9f88..2ba8efc6 100644 --- a/include/workspace.h +++ b/include/workspace.h @@ -186,3 +186,9 @@ Con *workspace_encapsulate(Con *ws); * */ void workspace_move_to_output(Con *ws, Output *output); + +/* + * Create all workspaces specified in the config bindings. + * + */ +void workspace_init(void); diff --git a/src/main.c b/src/main.c index f679966f..0f9f7151 100644 --- a/src/main.c +++ b/src/main.c @@ -1199,6 +1199,7 @@ int main(int argc, char *argv[]) { atexit(i3_exit); sd_notify(1, "READY=1"); + workspace_init(); ev_loop(main_loop, 0); /* Free these heap allocations just to satisfy LeakSanitizer. */ diff --git a/src/workspace.c b/src/workspace.c index 1bf1225c..c4caec88 100644 --- a/src/workspace.c +++ b/src/workspace.c @@ -514,8 +514,8 @@ void workspace_show(Con *workspace) { * client, which will clear the urgency flag too early. Also, there is no * way for con_focus() to know about when to clear urgency immediately and * when to defer it. */ + /* if (old && TAILQ_EMPTY(&(old->nodes_head)) && TAILQ_EMPTY(&(old->floating_head))) { - /* check if this workspace is currently visible */ if (!workspace_is_visible(old)) { LOG("Closing old workspace (%p / %s), it is empty\n", old, old->name); yajl_gen gen = ipc_marshal_workspace_event("empty", old, NULL); @@ -528,7 +528,6 @@ void workspace_show(Con *workspace) { y(free); - /* Avoid calling output_push_sticky_windows later with a freed container. */ if (old == old_focus) { old_focus = NULL; } @@ -536,6 +535,7 @@ void workspace_show(Con *workspace) { ewmh_update_desktop_properties(); } } + */ workspace->fullscreen_mode = CF_OUTPUT; LOG("focused now = %p / %s\n", focused, focused->name); @@ -1073,3 +1073,19 @@ void workspace_move_to_output(Con *ws, Output *output) { break; } } + +void workspace_init(void) +{ + int i = 0; + char *c = binding_workspace_names[0]; + + + while (c != NULL) { + DLOG("bwn: %s\n", c); + workspace_get(c); + i++; + c = binding_workspace_names[i]; + } + + //workspace_show_by_name(binding_workspace_names[0]); +}