mirror of
https://github.com/swaywm/sway.git
synced 2024-11-23 00:11:28 +00:00
Operate on floating split container when a child is focused
This commit is contained in:
parent
902a1402ba
commit
936168e740
|
@ -29,6 +29,14 @@ struct cmd_results *cmd_floating(int argc, char **argv) {
|
||||||
seat_set_focus(config->handler_context.seat, container);
|
seat_set_focus(config->handler_context.seat, container);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If the container is in a floating split container,
|
||||||
|
// operate on the split container instead of the child.
|
||||||
|
if (container_is_floating_or_child(container)) {
|
||||||
|
while (container->parent->layout != L_FLOATING) {
|
||||||
|
container = container->parent;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool wants_floating;
|
bool wants_floating;
|
||||||
if (strcasecmp(argv[0], "enable") == 0) {
|
if (strcasecmp(argv[0], "enable") == 0) {
|
||||||
wants_floating = true;
|
wants_floating = true;
|
||||||
|
|
|
@ -19,11 +19,19 @@ struct cmd_results *cmd_scratchpad(int argc, char **argv) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config->handler_context.using_criteria) {
|
if (config->handler_context.using_criteria) {
|
||||||
|
struct sway_container *con = config->handler_context.current_container;
|
||||||
|
|
||||||
|
// If the container is in a floating split container,
|
||||||
|
// operate on the split container instead of the child.
|
||||||
|
if (container_is_floating_or_child(con)) {
|
||||||
|
while (con->parent->layout != L_FLOATING) {
|
||||||
|
con = con->parent;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// If using criteria, this command is executed for every container which
|
// If using criteria, this command is executed for every container which
|
||||||
// matches the criteria. If this container isn't in the scratchpad,
|
// matches the criteria. If this container isn't in the scratchpad,
|
||||||
// we'll just silently return a success.
|
// we'll just silently return a success.
|
||||||
struct sway_container *con = config->handler_context.current_container;
|
|
||||||
wlr_log(WLR_INFO, "cmd_scratchpad(%s)", con->name);
|
|
||||||
if (!con->scratchpad) {
|
if (!con->scratchpad) {
|
||||||
return cmd_results_new(CMD_SUCCESS, NULL, NULL);
|
return cmd_results_new(CMD_SUCCESS, NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
|
@ -110,6 +110,15 @@ void scratchpad_toggle_auto(void) {
|
||||||
struct sway_container *ws = focus->type == C_WORKSPACE ?
|
struct sway_container *ws = focus->type == C_WORKSPACE ?
|
||||||
focus : container_parent(focus, C_WORKSPACE);
|
focus : container_parent(focus, C_WORKSPACE);
|
||||||
|
|
||||||
|
// If the focus is in a floating split container,
|
||||||
|
// operate on the split container instead of the child.
|
||||||
|
if (container_is_floating_or_child(focus)) {
|
||||||
|
while (focus->parent->layout != L_FLOATING) {
|
||||||
|
focus = focus->parent;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Check if the currently focused window is a scratchpad window and should
|
// Check if the currently focused window is a scratchpad window and should
|
||||||
// be hidden again.
|
// be hidden again.
|
||||||
if (focus->scratchpad) {
|
if (focus->scratchpad) {
|
||||||
|
|
Loading…
Reference in a new issue