add config variable for emtpy workspaces

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1197,6 +1197,10 @@ int main(int argc, char *argv[]) {
atexit(i3_exit);
sd_notify(1, "READY=1");
workspace_init();
if (config.empty_workspaces) {
workspace_init();
}
ev_loop(main_loop, 0);
}

View File

@ -506,8 +506,9 @@ 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))) {
if (old && TAILQ_EMPTY(&(old->nodes_head)) && TAILQ_EMPTY(&(old->floating_head))
&& !config.empty_workspaces) {
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);
@ -527,7 +528,6 @@ void workspace_show(Con *workspace) {
ewmh_update_desktop_properties();
}
}
*/
workspace->fullscreen_mode = CF_OUTPUT;
LOG("focused now = %p / %s\n", focused, focused->name);