diff --git a/src/config/parse_config.h b/src/config/parse_config.h index e02b5017..b92d81e8 100644 --- a/src/config/parse_config.h +++ b/src/config/parse_config.h @@ -938,6 +938,7 @@ FuncType parse_func_name(char *func_name, Arg *arg, char *arg_value, if (strcmp(func_name, "focusstack") == 0) { func = focusstack; (*arg).i = parse_circle_direction(arg_value); + (*arg).i2 = atoi(arg_value2); } else if (strcmp(func_name, "focusdir") == 0) { func = focusdir; (*arg).i = parse_direction(arg_value); @@ -955,6 +956,7 @@ FuncType parse_func_name(char *func_name, Arg *arg, char *arg_value, } else if (strcmp(func_name, "exchange_stack_client") == 0) { func = exchange_stack_client; (*arg).i = parse_circle_direction(arg_value); + (*arg).i2 = atoi(arg_value2); } else if (strcmp(func_name, "toggleglobal") == 0) { func = toggleglobal; } else if (strcmp(func_name, "toggleoverview") == 0) { diff --git a/src/dispatch/bind_define.h b/src/dispatch/bind_define.h index f5992e29..98d1ab74 100644 --- a/src/dispatch/bind_define.h +++ b/src/dispatch/bind_define.h @@ -122,12 +122,14 @@ int32_t exchange_stack_client(const Arg *arg) { Client *c = selmon->sel; Client *tc = NULL; + bool nowrap = arg->i2; + if (!c || c->isfloating || c->isfullscreen || c->ismaximizescreen) return 0; if (arg->i == NEXT) { - tc = get_next_stack_client(c, false); + tc = get_next_stack_client(c, false, nowrap); } else { - tc = get_next_stack_client(c, true); + tc = get_next_stack_client(c, true, nowrap); } if (tc) exchange_two_client(c, tc); @@ -244,13 +246,14 @@ int32_t focusstack(const Arg *arg) { /* Focus the next or previous client (in tiling order) on selmon */ Client *sel = focustop(selmon); Client *tc = NULL; + bool nowrap = arg->i2; if (!sel) return 0; if (arg->i == NEXT) { - tc = get_next_stack_client(sel, false); + tc = get_next_stack_client(sel, false, nowrap); } else { - tc = get_next_stack_client(sel, true); + tc = get_next_stack_client(sel, true, nowrap); } /* If only one client is visible on selmon, then c == sel */ diff --git a/src/fetch/client.h b/src/fetch/client.h index 8fe831be..a1133644 100644 --- a/src/fetch/client.h +++ b/src/fetch/client.h @@ -475,15 +475,19 @@ Client *focustop(Monitor *m) { return NULL; } -Client *get_next_stack_client(Client *c, bool reverse) { +Client *get_next_stack_client(Client *c, bool reverse, bool nowrap) { if (!c || !c->mon) return NULL; Client *next = NULL; if (reverse) { wl_list_for_each_reverse(next, &c->link, link) { - if (&next->link == &clients) - continue; /* wrap past the sentinel node */ + if (&next->link == &clients) { + if (nowrap) + return NULL; + else + continue; /* wrap past the sentinel node */ + } if (next->isunglobal) continue; @@ -493,8 +497,12 @@ Client *get_next_stack_client(Client *c, bool reverse) { } } else { wl_list_for_each(next, &c->link, link) { - if (&next->link == &clients) - continue; /* wrap past the sentinel node */ + if (&next->link == &clients) { + if (nowrap) + return NULL; + else + continue; /* wrap past the sentinel node */ + } if (next->isunglobal) continue; diff --git a/src/mango.c b/src/mango.c index 8fdff709..a44ba5e2 100644 --- a/src/mango.c +++ b/src/mango.c @@ -779,7 +779,7 @@ static bool switch_scratchpad_client_state(Client *c); static bool check_trackpad_disabled(struct wlr_pointer *pointer); static uint32_t get_tag_status(uint32_t tag, Monitor *m); static void enable_adaptive_sync(Monitor *m, struct wlr_output_state *state); -static Client *get_next_stack_client(Client *c, bool reverse); +static Client *get_next_stack_client(Client *c, bool reverse, bool nowrap); static void set_float_malposition(Client *tc); static void set_size_per(Monitor *m, Client *c); static void resize_tile_client(Client *grabc, bool isdrag, int32_t offsetx,