sites

public wiki contents of suckless.org
git clone git://git.suckless.org/sites
Log | Files | Refs

dwm-multimon-5-push_up_down-6.4.patch (5895B)


      1 From 9a762d6e157bb057c7296f94579ab9632882d60f Mon Sep 17 00:00:00 2001
      2 From: "Gary B. Genett" <me@garybgenett.net>
      3 Date: Sun, 19 Feb 2023 09:37:49 -0800
      4 Subject: patches/push: dwm-push-20201112-61bb8b2.diff
      5 MIME-Version: 1.0
      6 Content-Type: multipart/mixed; boundary="------------2.37.4"
      7 
      8 This is a multi-part message in MIME format.
      9 --------------2.37.4
     10 Content-Type: text/plain; charset=UTF-8; format=fixed
     11 Content-Transfer-Encoding: 8bit
     12 
     13 
     14 	modified from sites: 38b351cf3689ff3fa4845d35ce9894fd9253dbb8
     15 ---
     16  config.def.h |  2 ++
     17  dwm.c        | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
     18  2 files changed, 61 insertions(+)
     19 
     20 
     21 --------------2.37.4
     22 Content-Type: text/x-patch; name="0005-patches-push-dwm-push-20201112-61bb8b2.diff.patch"
     23 Content-Transfer-Encoding: 8bit
     24 Content-Disposition: attachment; filename="0005-patches-push-dwm-push-20201112-61bb8b2.diff.patch"
     25 
     26 diff --git a/config.def.h b/config.def.h
     27 index fcfe8245a438686f276ffc9a4df17695382ed58b..fd00f7080db9271912d0e4352434739d3c08e1b3 100644
     28 --- a/config.def.h
     29 +++ b/config.def.h
     30 @@ -71,20 +71,22 @@ static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn()
     31  static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, NULL };
     32  static const char *termcmd[]  = { "st", NULL };
     33  
     34  static const Key keys[] = {
     35  	/* modifier                     key        function        argument */
     36  	{ MODKEY,                       XK_p,      spawn,          {.v = dmenucmd } },
     37  	{ MODKEY|ShiftMask,             XK_Return, spawn,          {.v = termcmd } },
     38  	{ MODKEY,                       XK_b,      togglebar,      {0} },
     39  	{ MODKEY,                       XK_j,      focusstack,     {.i = +1 } },
     40  	{ MODKEY,                       XK_k,      focusstack,     {.i = -1 } },
     41 +	{ MODKEY|ShiftMask,             XK_j,      pushdown,       {0} },
     42 +	{ MODKEY|ShiftMask,             XK_k,      pushup,         {0} },
     43  	{ MODKEY,                       XK_i,      incnmaster,     {.i = +1 } },
     44  	{ MODKEY,                       XK_d,      incnmaster,     {.i = -1 } },
     45  	{ MODKEY,                       XK_h,      setmfact,       {.f = -0.05} },
     46  	{ MODKEY,                       XK_l,      setmfact,       {.f = +0.05} },
     47  	{ MODKEY,                       XK_Return, zoom,           {0} },
     48  	{ MODKEY,                       XK_Tab,    view,           {0} },
     49  	{ MODKEY|ShiftMask,             XK_c,      killclient,     {0} },
     50  	{ MODKEY,                       XK_t,      setlayout,      {.v = &layouts[0]} },
     51  	{ MODKEY,                       XK_f,      setlayout,      {.v = &layouts[1]} },
     52  	{ MODKEY,                       XK_m,      setlayout,      {.v = &layouts[2]} },
     53 diff --git a/dwm.c b/dwm.c
     54 index 77ff310e03edbf42ac2dd55471962ce259b63071..5aa229611a27b8aa943308314b494c10e2364137 100644
     55 --- a/dwm.c
     56 +++ b/dwm.c
     57 @@ -178,25 +178,28 @@ static void grabbuttons(Client *c, int focused);
     58  static void grabkeys(void);
     59  static void incnmaster(const Arg *arg);
     60  static void keypress(XEvent *e);
     61  static void killclient(const Arg *arg);
     62  static void manage(Window w, XWindowAttributes *wa);
     63  static void mappingnotify(XEvent *e);
     64  static void maprequest(XEvent *e);
     65  static void monocle(Monitor *m);
     66  static void motionnotify(XEvent *e);
     67  static void movemouse(const Arg *arg);
     68 +static Client *prevtiled(Client *c);
     69  static Client *nexttiled(Client *c);
     70  static void pop(Client *c);
     71  static void propertynotify(XEvent *e);
     72  static void quit(const Arg *arg);
     73  static Monitor *recttomon(int x, int y, int w, int h);
     74 +static void pushdown(const Arg *arg);
     75 +static void pushup(const Arg *arg);
     76  static void resize(Client *c, int x, int y, int w, int h, int interact);
     77  static void resizeclient(Client *c, int x, int y, int w, int h);
     78  static void resizemouse(const Arg *arg);
     79  static void restack(Monitor *m);
     80  static void run(void);
     81  static void scan(void);
     82  static int sendevent(Client *c, Atom proto);
     83  static void sendmon(Client *c, Monitor *m);
     84  static void setclientstate(Client *c, long state);
     85  static void setfocus(Client *c);
     86 @@ -1206,20 +1209,31 @@ movemouse(const Arg *arg)
     87  		}
     88  	} while (ev.type != ButtonRelease);
     89  	XUngrabPointer(dpy, CurrentTime);
     90  	if ((m = recttomon(c->x, c->y, c->w, c->h)) != selmon) {
     91  		sendmon(c, m);
     92  		selmon = m;
     93  		focus(NULL);
     94  	}
     95  }
     96  
     97 +Client *
     98 +prevtiled(Client *c)
     99 +{
    100 +	Client *p, *r;
    101 +
    102 +	for(p = selmon->clients, r = NULL; p && p != c; p = p->next)
    103 +		if(!p->isfloating && ISVISIBLE(p))
    104 +			r = p;
    105 +	return r;
    106 +}
    107 +
    108  Client *
    109  nexttiled(Client *c)
    110  {
    111  	for (; c && (c->isfloating || !ISVISIBLE(c)); c = c->next);
    112  	return c;
    113  }
    114  
    115  void
    116  pop(Client *c)
    117  {
    118 @@ -1279,20 +1293,65 @@ recttomon(int x, int y, int w, int h)
    119  	int a, area = 0;
    120  
    121  	for (m = mons; m; m = m->next)
    122  		if ((a = INTERSECT(x, y, w, h, m)) > area) {
    123  			area = a;
    124  			r = m;
    125  		}
    126  	return r;
    127  }
    128  
    129 +void
    130 +pushdown(const Arg *arg)
    131 +{
    132 +	Client *sel = selmon->sel, *c;
    133 +
    134 +	if(!sel || sel->isfloating)
    135 +		return;
    136 +	if((c = nexttiled(sel->next))) {
    137 +		detach(sel);
    138 +		sel->next = c->next;
    139 +		c->next = sel;
    140 +	} else {
    141 +		detach(sel);
    142 +		attach(sel);
    143 +	}
    144 +	focus(sel);
    145 +	arrange(selmon);
    146 +}
    147 +
    148 +void
    149 +pushup(const Arg *arg)
    150 +{
    151 +	Client *sel = selmon->sel, *c;
    152 +
    153 +	if(!sel || sel->isfloating)
    154 +		return;
    155 +	if((c = prevtiled(sel))) {
    156 +		detach(sel);
    157 +		sel->next = c;
    158 +		if(selmon->clients == c)
    159 +			selmon->clients = sel;
    160 +		else {
    161 +			for(c = selmon->clients; c->next != sel->next; c = c->next);
    162 +			c->next = sel;
    163 +		}
    164 +	} else {
    165 +		for(c = sel; c->next; c = c->next);
    166 +		detach(sel);
    167 +		sel->next = NULL;
    168 +		c->next = sel;
    169 +	}
    170 +	focus(sel);
    171 +	arrange(selmon);
    172 +}
    173 +
    174  void
    175  resize(Client *c, int x, int y, int w, int h, int interact)
    176  {
    177  	if (applysizehints(c, &x, &y, &w, &h, interact))
    178  		resizeclient(c, x, y, w, h);
    179  }
    180  
    181  void
    182  resizeclient(Client *c, int x, int y, int w, int h)
    183  {
    184 
    185 --------------2.37.4--
    186 
    187