Implement 'split'
This commit is contained in:
@ -101,6 +101,7 @@ move { return TOK_MOVE; }
|
||||
open { return TOK_OPEN; }
|
||||
next { return TOK_NEXT; }
|
||||
prev { return TOK_PREV; }
|
||||
split { return TOK_SPLIT; }
|
||||
horizontal { return TOK_HORIZONTAL; }
|
||||
vertical { return TOK_VERTICAL; }
|
||||
|
||||
|
@ -113,6 +113,7 @@ void parse_cmd(const char *new) {
|
||||
%token TOK_OPEN "open"
|
||||
%token TOK_NEXT "next"
|
||||
%token TOK_PREV "prev"
|
||||
%token TOK_SPLIT "split"
|
||||
%token TOK_HORIZONTAL "horizontal"
|
||||
%token TOK_VERTICAL "vertical"
|
||||
|
||||
@ -256,6 +257,7 @@ operation:
|
||||
| fullscreen
|
||||
| next
|
||||
| prev
|
||||
| split
|
||||
;
|
||||
|
||||
exec:
|
||||
@ -357,6 +359,14 @@ prev:
|
||||
}
|
||||
;
|
||||
|
||||
split:
|
||||
TOK_SPLIT WHITESPACE direction
|
||||
{
|
||||
printf("splitting in direction %c\n", $<chr>3);
|
||||
tree_split(focused, ($<chr>3 == 'v' ? VERT : HORIZ));
|
||||
}
|
||||
;
|
||||
|
||||
direction:
|
||||
TOK_HORIZONTAL { $<chr>$ = 'h'; }
|
||||
| 'h' { $<chr>$ = 'h'; }
|
||||
|
@ -167,6 +167,11 @@ void tree_close_con() {
|
||||
*
|
||||
*/
|
||||
void tree_split(Con *con, orientation_t orientation) {
|
||||
/* for a workspace, we just need to change orientation */
|
||||
if (con->parent->type == CT_OUTPUT) {
|
||||
con->orientation = orientation;
|
||||
return;
|
||||
}
|
||||
/* 2: replace it with a new Con */
|
||||
Con *new = con_new(NULL);
|
||||
Con *parent = con->parent;
|
||||
|
Reference in New Issue
Block a user