diff --git a/src/dispatch/bind_define.h b/src/dispatch/bind_define.h index ed4d9e2..39f57c8 100644 --- a/src/dispatch/bind_define.h +++ b/src/dispatch/bind_define.h @@ -111,7 +111,9 @@ int32_t exchange_client(const Arg *arg) { if ((c->isfullscreen || c->ismaximizescreen) && !is_scroller_layout(c->mon)) return 0; - exchange_two_client(c, direction_select(arg)); + Client *tc = direction_select(arg); + tc = get_focused_stack_client(tc); + exchange_two_client(c, tc); return 0; } diff --git a/src/mango.c b/src/mango.c index 3b95eca..97430e1 100644 --- a/src/mango.c +++ b/src/mango.c @@ -4828,6 +4828,11 @@ void exchange_two_client(Client *c1, Client *c2) { } else { arrange(c1->mon, false, false); } + + // In order to facilitate repeated exchanges for get_focused_stack_client + // set c2 focus order behind c1 + wl_list_remove(&c2->flink); + wl_list_insert(&c1->flink, &c2->flink); } void set_activation_env() {