Implemented config key 'new_container'
This commit is contained in:
parent
21c7a69812
commit
650eebc347
|
@ -92,7 +92,7 @@ struct Config {
|
|||
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;
|
||||
|
||||
|
|
|
@ -106,9 +106,10 @@ workspace_bar { return TOKWORKSPACEBAR; }
|
|||
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; }
|
||||
|
|
|
@ -235,7 +235,9 @@ void parse_file(const char *f) {
|
|||
%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"
|
||||
|
@ -393,10 +395,10 @@ direction:
|
|||
;
|
||||
|
||||
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
|
||||
|
@ -437,6 +439,12 @@ new_container:
|
|||
}
|
||||
;
|
||||
|
||||
layout_mode:
|
||||
TOK_DEFAULT { $<number>$ = L_DEFAULT; }
|
||||
| TOK_STACKING { $<number>$ = L_STACKED; }
|
||||
| TOK_TABBED { $<number>$ = L_TABBED; }
|
||||
;
|
||||
|
||||
new_window:
|
||||
TOKNEWWINDOW WHITESPACE border_style
|
||||
{
|
||||
|
|
12
src/con.c
12
src/con.c
|
@ -59,8 +59,16 @@ Con *con_new(Con *parent) {
|
|||
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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue