dwm-movecenter-6.2.diff - sites - public wiki contents of suckless.org
 (HTM) git clone git://git.suckless.org/sites
 (DIR) Log
 (DIR) Files
 (DIR) Refs
       ---
       dwm-movecenter-6.2.diff (1366B)
       ---
            1 diff --git a/config.def.h b/config.def.h
            2 index 1c0b587..c5b14ba 100644
            3 --- a/config.def.h
            4 +++ b/config.def.h
            5 @@ -84,6 +84,7 @@ static Key keys[] = {
            6          { MODKEY,                       XK_period, focusmon,       {.i = +1 } },
            7          { MODKEY|ShiftMask,             XK_comma,  tagmon,         {.i = -1 } },
            8          { MODKEY|ShiftMask,             XK_period, tagmon,         {.i = +1 } },
            9 +        { MODKEY,                       XK_x,      movecenter,     {0} },
           10          TAGKEYS(                        XK_1,                      0)
           11          TAGKEYS(                        XK_2,                      1)
           12          TAGKEYS(                        XK_3,                      2)
           13 diff --git a/dwm.c b/dwm.c
           14 index 4465af1..292c70e 100644
           15 --- a/dwm.c
           16 +++ b/dwm.c
           17 @@ -183,6 +183,7 @@ static void maprequest(XEvent *e);
           18  static void monocle(Monitor *m);
           19  static void motionnotify(XEvent *e);
           20  static void movemouse(const Arg *arg);
           21 +static void movecenter(const Arg *arg);
           22  static Client *nexttiled(Client *c);
           23  static void pop(Client *);
           24  static void propertynotify(XEvent *e);
           25 @@ -1192,6 +1193,14 @@ movemouse(const Arg *arg)
           26          }
           27  }
           28  
           29 +void
           30 +movecenter(const Arg *arg)
           31 +{
           32 +        selmon->sel->x = selmon->sel->mon->mx + (selmon->sel->mon->mw - WIDTH(selmon->sel)) / 2;
           33 +        selmon->sel->y = selmon->sel->mon->my + (selmon->sel->mon->mh - HEIGHT(selmon->sel)) / 2;
           34 +        arrange(selmon);
           35 +}
           36 +
           37  Client *
           38  nexttiled(Client *c)
           39  {