add config variable for emtpy workspaces

This commit is contained in:
Akos Horvath 2022-10-22 21:34:14 +02:00
parent 3dff3d8b13
commit 3056caf6e3
6 changed files with 18 additions and 4 deletions

View File

@ -51,6 +51,7 @@ CFGFUN(floating_maximum_size, const long width, const long height);
CFGFUN(default_orientation, const char *orientation); CFGFUN(default_orientation, const char *orientation);
CFGFUN(workspace_layout, const char *layout); CFGFUN(workspace_layout, const char *layout);
CFGFUN(workspace_back_and_forth, const char *value); CFGFUN(workspace_back_and_forth, const char *value);
CFGFUN(empty_workspaces, const char *value);
CFGFUN(focus_follows_mouse, const char *value); CFGFUN(focus_follows_mouse, const char *value);
CFGFUN(mouse_warping, const char *value); CFGFUN(mouse_warping, const char *value);
CFGFUN(focus_wrapping, const char *value); CFGFUN(focus_wrapping, const char *value);

View File

@ -119,6 +119,9 @@ struct Config {
/** Default orientation for new containers */ /** Default orientation for new containers */
int default_orientation; int default_orientation;
/** Init empty workspaces on startup */
bool empty_workspaces;
/** By default, focus follows mouse. If the user explicitly wants to /** By default, focus follows mouse. If the user explicitly wants to
* turn this off (and instead rely only on the keyboard for changing * turn this off (and instead rely only on the keyboard for changing
* focus), we allow them to do this with this relatively special option. * focus), we allow them to do this with this relatively special option.

View File

@ -210,6 +210,8 @@ bool load_configuration(const char *override_configpath, config_load_t load_type
config.show_marks = true; config.show_marks = true;
config.empty_workspaces = false;
config.default_border = BS_NORMAL; config.default_border = BS_NORMAL;
config.default_floating_border = BS_NORMAL; config.default_floating_border = BS_NORMAL;
config.default_border_width = logical_px(2); config.default_border_width = logical_px(2);

View File

@ -411,6 +411,10 @@ CFGFUN(hide_edge_borders, const char *borders) {
config.hide_edge_borders = HEBM_NONE; config.hide_edge_borders = HEBM_NONE;
} }
CFGFUN(empty_workspaces, const char *value) {
config.empty_workspaces = boolstr(value);
}
CFGFUN(focus_follows_mouse, const char *value) { CFGFUN(focus_follows_mouse, const char *value) {
config.disable_focus_follows_mouse = !boolstr(value); config.disable_focus_follows_mouse = !boolstr(value);
} }

View File

@ -1199,7 +1199,11 @@ int main(int argc, char *argv[]) {
atexit(i3_exit); atexit(i3_exit);
sd_notify(1, "READY=1"); sd_notify(1, "READY=1");
if (config.empty_workspaces) {
workspace_init(); workspace_init();
}
ev_loop(main_loop, 0); ev_loop(main_loop, 0);
/* Free these heap allocations just to satisfy LeakSanitizer. */ /* Free these heap allocations just to satisfy LeakSanitizer. */

View File

@ -514,8 +514,9 @@ void workspace_show(Con *workspace) {
* client, which will clear the urgency flag too early. Also, there is no * 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 * way for con_focus() to know about when to clear urgency immediately and
* when to defer it. */ * when to defer it. */
/*
if (old && TAILQ_EMPTY(&(old->nodes_head)) && TAILQ_EMPTY(&(old->floating_head))) { if (old && TAILQ_EMPTY(&(old->nodes_head)) && TAILQ_EMPTY(&(old->floating_head))
&& !config.empty_workspaces) {
if (!workspace_is_visible(old)) { if (!workspace_is_visible(old)) {
LOG("Closing old workspace (%p / %s), it is empty\n", old, old->name); LOG("Closing old workspace (%p / %s), it is empty\n", old, old->name);
yajl_gen gen = ipc_marshal_workspace_event("empty", old, NULL); yajl_gen gen = ipc_marshal_workspace_event("empty", old, NULL);
@ -535,7 +536,6 @@ void workspace_show(Con *workspace) {
ewmh_update_desktop_properties(); ewmh_update_desktop_properties();
} }
} }
*/
workspace->fullscreen_mode = CF_OUTPUT; workspace->fullscreen_mode = CF_OUTPUT;
LOG("focused now = %p / %s\n", focused, focused->name); LOG("focused now = %p / %s\n", focused, focused->name);