diff options
Diffstat (limited to 'sway')
-rw-r--r-- | sway/border.c | 4 | ||||
-rw-r--r-- | sway/commands.c | 8 | ||||
-rw-r--r-- | sway/focus.c | 2 | ||||
-rw-r--r-- | sway/layout.c | 4 | ||||
-rw-r--r-- | sway/sway.5.txt | 4 |
5 files changed, 15 insertions, 7 deletions
diff --git a/sway/border.c b/sway/border.c index 55628972..d17d8d0c 100644 --- a/sway/border.c +++ b/sway/border.c @@ -281,7 +281,9 @@ void update_tabbed_stacked_titlebars(swayc_t *c, cairo_t *cr, struct wlc_geometr update_tabbed_stacked_titlebars(child, cr, g, focused, focused_inactive); } } else { - if (focused == c) { + bool is_child_of_focused = swayc_is_child_of(c, get_focused_container(&root_container)); + + if (focused == c || is_child_of_focused) { render_title_bar(c, cr, g, &config->border_colors.focused); } else if (focused_inactive == c) { render_title_bar(c, cr, g, &config->border_colors.focused_inactive); diff --git a/sway/commands.c b/sway/commands.c index ed561764..d572afa0 100644 --- a/sway/commands.c +++ b/sway/commands.c @@ -864,6 +864,8 @@ static struct cmd_results *cmd_focus(int argc, char **argv) { move_focus(MOVE_DOWN); } else if (strcasecmp(argv[0], "parent") == 0) { move_focus(MOVE_PARENT); + } else if (strcasecmp(argv[0], "child") == 0) { + move_focus(MOVE_CHILD); } else if (strcasecmp(argv[0], "mode_toggle") == 0) { int i; swayc_t *workspace = swayc_active_workspace(); @@ -903,7 +905,7 @@ static struct cmd_results *cmd_focus(int argc, char **argv) { } } else { return cmd_results_new(CMD_INVALID, "focus", - "Expected 'focus <direction|parent|mode_toggle>' or 'focus output <direction|name>'"); + "Expected 'focus <direction|parent|child|mode_toggle>' or 'focus output <direction|name>'"); } return cmd_results_new(CMD_SUCCESS, NULL, NULL); } @@ -1925,8 +1927,8 @@ static struct cmd_results *cmd_kill(int argc, char **argv) { if (config->reading) return cmd_results_new(CMD_FAILURE, "kill", "Can't be used in config file."); if (!config->active) return cmd_results_new(CMD_FAILURE, "kill", "Can only be used when sway is running."); - swayc_t *view = get_focused_container(&root_container); - wlc_view_close(view->handle); + swayc_t *container = get_focused_container(&root_container); + close_views(container); return cmd_results_new(CMD_SUCCESS, NULL, NULL); } diff --git a/sway/focus.c b/sway/focus.c index c7737a1d..0f629e1e 100644 --- a/sway/focus.c +++ b/sway/focus.c @@ -72,7 +72,7 @@ bool move_focus(enum movement_direction direction) { return false; } else if (new_view->type == C_OUTPUT) { return set_focused_container(swayc_active_workspace_for(new_view)); - } else if (direction == MOVE_PARENT) { + } else if (direction == MOVE_PARENT || direction == MOVE_CHILD) { return set_focused_container(new_view); } else if (config->mouse_warping) { swayc_t *old_op = old_view->type == C_OUTPUT ? diff --git a/sway/layout.c b/sway/layout.c index 1a046da4..fc7a31b4 100644 --- a/sway/layout.c +++ b/sway/layout.c @@ -1011,6 +1011,10 @@ static swayc_t *get_swayc_in_output_direction(swayc_t *output, enum movement_dir } swayc_t *get_swayc_in_direction_under(swayc_t *container, enum movement_direction dir, swayc_t *limit) { + if (dir == MOVE_CHILD) { + return container->focused; + } + swayc_t *parent = container->parent; if (dir == MOVE_PARENT) { if (parent->type == C_OUTPUT) { diff --git a/sway/sway.5.txt b/sway/sway.5.txt index 18b693f8..fdf5c0c1 100644 --- a/sway/sway.5.txt +++ b/sway/sway.5.txt @@ -59,8 +59,8 @@ They are expected to be used with **bindsym** or at runtime through **swaymsg**( Make focused view floating, non-floating, or the opposite of what it is now. **focus** <direction>:: - Direction may be one of _up_, _down_, _left_, _right_, or _parent_. The - directional focus commands will move the focus in that direction. The parent + Direction may be one of _up_, _down_, _left_, _right_, _parent_, or _child_. + The directional focus commands will move the focus in that direction. The parent focus command will change the focus to the parent of the currently focused container, which is useful, for example, to open a sibling of the parent container, or to move the entire container around. |