fix redundent check, refactor to findVisibleClient
Uses function findVisibleClient and the Elvis operator to clean the code up. Elvis depends on a gcc extension resulting in a warning from -wpedantic.
@@ -200,6 +200,19 @@ monocle(Monitor *m)
}
+void
+focusstack2(const Arg *arg)
+{
+ Client *nextVisibleClient = findVisibleClient(selmon->sel->next) ?: findVisibleClient(selmon->clients);
+
+ if (nextVisibleClient) {
+ if (nextVisibleClient->mon != selmon)
+ selmon = nextVisibleClient->mon;
+ detachstack(nextVisibleClient);
+ attachstack(nextVisibleClient);
+ selmon->sel = nextVisibleClient;
+ }
+}
void
focusstack2(const Arg *arg)
{
