const char *ipc_socket_path;
const char *restart_state_path;
- int container_mode;
+ int default_layout;
int container_stack_limit;
int container_stack_limit_value;
popup_during_fullscreen { return TOK_POPUP_DURING_FULLSCREEN; }
ignore { return TOK_IGNORE; }
leave_fullscreen { return TOK_LEAVE_FULLSCREEN; }
-default { /* yylval.number = MODE_DEFAULT; */return TOKCONTAINERMODE; }
-stacking { /* yylval.number = MODE_STACK; */return TOKCONTAINERMODE; }
-tabbed { /* yylval.number = MODE_TABBED; */return TOKCONTAINERMODE; }
+default { /* yylval.number = MODE_DEFAULT; */return TOK_DEFAULT; }
+stacking { /* yylval.number = MODE_STACK; */return TOK_STACKING; }
+stacked { return TOK_STACKING; }
+tabbed { /* yylval.number = MODE_TABBED; */return TOK_TABBED; }
stack-limit { return TOKSTACKLIMIT; }
cols { /* yylval.number = STACK_LIMIT_COLS; */return TOKSTACKLIMIT; }
rows { /* yylval.number = STACK_LIMIT_ROWS; */return TOKSTACKLIMIT; }
%token TOK_1PIXEL "1pixel"
%token TOKFOCUSFOLLOWSMOUSE "focus_follows_mouse"
%token TOKWORKSPACEBAR "workspace_bar"
-%token TOKCONTAINERMODE "default/stacking/tabbed"
+%token TOK_DEFAULT "default"
+%token TOK_STACKING "stacking"
+%token TOK_TABBED "tabbed"
%token TOKSTACKLIMIT "stack-limit"
%token TOK_POPUP_DURING_FULLSCREEN "popup_during_fullscreen"
%token TOK_IGNORE "ignore"
;
new_container:
- TOKNEWCONTAINER WHITESPACE TOKCONTAINERMODE
+ TOKNEWCONTAINER WHITESPACE layout_mode
{
DLOG("new containers will be in mode %d\n", $<number>3);
- config.container_mode = $<number>3;
+ config.default_layout = $<number>3;
#if 0
/* We also need to change the layout of the already existing
}
;
+layout_mode:
+ TOK_DEFAULT { $<number>$ = L_DEFAULT; }
+ | TOK_STACKING { $<number>$ = L_STACKED; }
+ | TOK_TABBED { $<number>$ = L_TABBED; }
+ ;
+
new_window:
TOKNEWWINDOW WHITESPACE border_style
{
TAILQ_INIT(&(new->focus_head));
TAILQ_INIT(&(new->swallow_head));
- if (parent != NULL)
- con_attach(new, parent, false);
+ if (parent != NULL) {
+ /* Set layout of ws if this is the first child of the ws. */
+ if (parent->type == CT_WORKSPACE && con_is_leaf(parent)) {
+ con_set_layout(new, config.default_layout);
+ con_attach(new, parent, false);
+ con_set_layout(parent, config.default_layout);
+ } else {
+ con_attach(new, parent, false);
+ }
+ }
return new;
}