URI: 
       dwm-tagshift-6.3.diff - sites - public wiki contents of suckless.org
  HTML git clone git://git.suckless.org/sites
   DIR Log
   DIR Files
   DIR Refs
       ---
       dwm-tagshift-6.3.diff (2239B)
       ---
            1 diff --git a/config.def.h b/config.def.h
            2 index a2ac963..1bbede2 100644
            3 --- a/config.def.h
            4 +++ b/config.def.h
            5 @@ -69,6 +69,10 @@ static Key keys[] = {
            6          { MODKEY,                       XK_k,      focusstack,     {.i = -1 } },
            7          { MODKEY,                       XK_i,      incnmaster,     {.i = +1 } },
            8          { MODKEY,                       XK_d,      incnmaster,     {.i = -1 } },
            9 +        { MODKEY,                       XK_Left,   shiftview,      {.i = -1 } },
           10 +        { MODKEY,                       XK_Right,  shiftview,      {.i = +1 } },
           11 +        { MODKEY|ShiftMask,             XK_Left,   shifttag,       {.i = -1 } },
           12 +        { MODKEY|ShiftMask,             XK_Right,  shifttag,       {.i = +1 } },
           13          { MODKEY,                       XK_h,      setmfact,       {.f = -0.05} },
           14          { MODKEY,                       XK_l,      setmfact,       {.f = +0.05} },
           15          { MODKEY,                       XK_Return, zoom,           {0} },
           16 diff --git a/dwm.c b/dwm.c
           17 index a96f33c..4bf0f70 100644
           18 --- a/dwm.c
           19 +++ b/dwm.c
           20 @@ -204,6 +204,8 @@ static void setlayout(const Arg *arg);
           21  static void setmfact(const Arg *arg);
           22  static void setup(void);
           23  static void seturgent(Client *c, int urg);
           24 +static void shiftview(const Arg *arg);
           25 +static void shifttag(const Arg *arg);
           26  static void showhide(Client *c);
           27  static void sigchld(int unused);
           28  static void spawn(const Arg *arg);
           29 @@ -1632,6 +1634,40 @@ showhide(Client *c)
           30          }
           31  }
           32  
           33 +void
           34 +shiftview(const Arg *arg) {
           35 +        Arg shifted;
           36 +
           37 +        if(arg->i > 0) /* left circular shift */
           38 +                shifted.ui = (selmon->tagset[selmon->seltags] << arg->i)
           39 +                   | (selmon->tagset[selmon->seltags] >> (LENGTH(tags) - arg->i));
           40 +
           41 +        else /* right circular shift */
           42 +                shifted.ui = selmon->tagset[selmon->seltags] >> (- arg->i)
           43 +                   | selmon->tagset[selmon->seltags] << (LENGTH(tags) + arg->i);
           44 +
           45 +        view(&shifted);
           46 +}
           47 +
           48 +void
           49 +shifttag(const Arg *arg) {
           50 +        Arg shifted;
           51 +        Client *c;
           52 +
           53 +        if (!selmon->sel)
           54 +                return;
           55 +        c = selmon->sel;
           56 +
           57 +        if (arg->i > 0) /* left circular shift */
           58 +                shifted.ui = (c->tags ^ (c->tags << arg->i)) 
           59 +                        ^ (c->tags >> (LENGTH(tags) - arg->i));
           60 +        else /* right circular shift */
           61 +                shifted.ui = (c->tags ^ (c->tags >> (-arg->i)))
           62 +                        ^ (c->tags << (LENGTH(tags) + arg->i));
           63 +
           64 +        toggletag(&shifted);
           65 +}
           66 +
           67  void
           68  sigchld(int unused)
           69  {