%token TOK_PPT "ppt"
%token TOK_NOP "nop"
%token TOK_BACK_AND_FORTH "back_and_forth"
+%token TOK_NO_STARTUP_ID "--no-startup-id"
%token TOK_CLASS "class"
%token TOK_INSTANCE "instance"
%type <number> resize_way
%type <number> resize_tiling
%type <number> optional_kill_mode
+%type <number> optional_no_startup_id
%%
;
exec:
- TOK_EXEC STR
+ TOK_EXEC optional_no_startup_id STR
{
- char *command = $2;
- bool no_startup_id = false;
- if (strncasecmp($2, "--no-startup-id ", strlen("--no-startup-id ")) == 0) {
- no_startup_id = true;
- command += strlen("--no-startup-id ");
- }
+ char *command = $3;
+ bool no_startup_id = $2;
printf("should execute %s, no_startup_id = %d\n", command, no_startup_id);
start_application(command, no_startup_id);
- free($2);
+ free($3);
}
;
+optional_no_startup_id:
+ /* empty */ { $$ = false; }
+ | TOK_NO_STARTUP_ID { $$ = true; }
+ ;
+
exit:
TOK_EXIT
{
int count = 0;
TAILQ_FOREACH(current, &owindows, owindows) {
Con *ws = con_get_workspace(current->con);
+ /* If no workspace could be found, this was a dock window.
+ * Just skip it, you cannot focus dock windows. */
+ if (!ws)
+ continue;
/* If the container is not on the current workspace,
* workspace_show() will switch to a different workspace and (if
TAILQ_FOREACH(current, &owindows, owindows) {
printf("matching: %p / %s\n", current->con, current->con->name);
+ int border_style = current->con->border_style;
if ($2 == TOK_TOGGLE) {
- current->con->border_style++;
- current->con->border_style %= 3;
- } else current->con->border_style = $2;
+ border_style++;
+ border_style %= 3;
+ } else border_style = $2;
+ con_set_border_style(current->con, border_style);
}
tree_render();
;
move:
- TOK_MOVE direction
+ TOK_MOVE direction resize_px
{
- printf("moving in direction %d\n", $2);
- tree_move($2);
+ int direction = $2;
+ int px = $3;
+
+ /* TODO: make 'move' work with criteria. */
+ printf("moving in direction %d\n", direction);
+ if (con_is_floating(focused)) {
+ printf("floating move with %d pixels\n", px);
+ if (direction == TOK_LEFT) {
+ focused->parent->rect.x -= px;
+ } else if (direction == TOK_RIGHT) {
+ focused->parent->rect.x += px;
+ } else if (direction == TOK_UP) {
+ focused->parent->rect.y -= px;
+ } else if (direction == TOK_DOWN) {
+ focused->parent->rect.y += px;
+ }
+ } else {
+ tree_move(direction);
+ }
tree_render();
}
{
owindow *current;
+ /* Error out early to not create a non-existing workspace (in
+ * workspace_get()) if we are not actually able to move anything. */
+ if (match_is_empty(¤t_match) && focused->type == CT_WORKSPACE)
+ break;
+
printf("should move window to workspace %s\n", $3);
/* get the workspace */
Con *ws = workspace_get($3, NULL);
mark:
TOK_MARK STR
{
+ printf("Clearing all windows which have that mark first\n");
+
+ Con *con;
+ TAILQ_FOREACH(con, &all_cons, all_cons) {
+ if (con->mark && strcmp(con->mark, $2) == 0)
+ FREE(con->mark);
+ }
+
printf("marking window with str %s\n", $2);
owindow *current;
TAILQ_FOREACH(current, &owindows, owindows) {
printf("matching: %p / %s\n", current->con, current->con->name);
- current->con->mark = sstrdup($2);
+ current->con->mark = $2;
}
- free($<string>2);
-
tree_render();
}
;
while (current->parent->layout == L_STACKED ||
current->parent->layout == L_TABBED)
current = current->parent;
+
+ /* Then further go up until we find one with the matching orientation. */
+ orientation_t search_orientation =
+ (direction == TOK_LEFT || direction == TOK_RIGHT ? HORIZ : VERT);
+
+ while (current->type != CT_WORKSPACE &&
+ current->type != CT_FLOATING_CON &&
+ current->parent->orientation != search_orientation)
+ current = current->parent;
+
/* get the default percentage */
int children = con_num_children(current->parent);
Con *other;