dwm-switchcol-6.1.diff - sites - public wiki contents of suckless.org
 (HTM) git clone git://git.suckless.org/sites
 (DIR) Log
 (DIR) Files
 (DIR) Refs
       ---
       dwm-switchcol-6.1.diff (1126B)
       ---
            1 diff -urp dwm-6.1/dwm.c dwm-6.1-patched/dwm.c
            2 --- dwm-6.1/dwm.c        2015-11-09 06:39:37.000000000 +0800
            3 +++ dwm-6.1-patched/dwm.c        2016-03-24 23:56:35.435047948 +0800
            4 @@ -206,6 +206,7 @@ static void setup(void);
            5  static void showhide(Client *c);
            6  static void sigchld(int unused);
            7  static void spawn(const Arg *arg);
            8 +static void switchcol(const Arg *arg);
            9  static void tag(const Arg *arg);
           10  static void tagmon(const Arg *arg);
           11  static void tile(Monitor *);
           12 @@ -1645,6 +1646,35 @@ spawn(const Arg *arg)
           13          }
           14  }
           15  
           16 +void
           17 +switchcol(const Arg *arg)
           18 +{
           19 +        Client *c, *t;
           20 +        int col = 0;
           21 +        int i;
           22 +
           23 +        if (!selmon->sel)
           24 +                return;
           25 +        for (i = 0, c = nexttiled(selmon->clients); c ;
           26 +             c = nexttiled(c->next), i++) {
           27 +                if (c == selmon->sel)
           28 +                        col = (i + 1) > selmon->nmaster;
           29 +        }
           30 +        if (i <= selmon->nmaster)
           31 +                return;
           32 +        for (c = selmon->stack; c; c = c->snext) {
           33 +                if (!ISVISIBLE(c))
           34 +                        continue;
           35 +                for (i = 0, t = nexttiled(selmon->clients); t && t != c;
           36 +                     t = nexttiled(t->next), i++);
           37 +                if (t && (i + 1 > selmon->nmaster) != col) {
           38 +                        focus(c);
           39 +                        restack(selmon);
           40 +                        break;
           41 +                }
           42 +        }
           43 +}
           44 +
           45  void
           46  tag(const Arg *arg)
           47  {