diff --git a/action.c b/action.c index 14fb1a7..4dd308a 100644 --- a/action.c +++ b/action.c @@ -58,10 +58,13 @@ void action_cycle(void *data, int num, client *cli) { if (!cli) return; STACK_INIT(lower); - spot_focus_top_window(cli->spot, cli->monitor, cli->window); - client_stack_family(cli, &lower); - XLowerWindow(display, lower.windows[0]); - XRestackWindows(display, lower.windows, lower.depth); + if (spot_count_windows(cli->spot, cli->monitor) > 1) + { + spot_focus_top_window(cli->spot, cli->monitor, cli->window); + client_stack_family(cli, &lower); + XLowerWindow(display, lower.windows[0]); + XRestackWindows(display, lower.windows, lower.depth); + } } void action_raise_nth(void *data, int num, client *cli) diff --git a/spot.c b/spot.c index 7cf7ef3..c2216d2 100644 --- a/spot.c +++ b/spot.c @@ -132,3 +132,9 @@ int spot_choose_by_direction(int spot, int mon, int dir) return spot; } +int spot_count_windows(int spot, int mon) +{ + int i, n = 0; client *c; + for_windows(i, c) if (c->manage && c->spot == spot && c->monitor == mon) n++; + return n; +} \ No newline at end of file