From b513992a8f3249d1d9e8914f8c8b987d9c8e70eb Mon Sep 17 00:00:00 2001 From: bakkeby Date: Thu, 27 May 2021 09:56:49 +0200 Subject: [PATCH] floatpos: adding feature to spawn floating window underneath the mouse cursor --- dwm/dwm-floatpos-6.2.diff | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/dwm/dwm-floatpos-6.2.diff b/dwm/dwm-floatpos-6.2.diff index c274448..56e2d3b 100644 --- a/dwm/dwm-floatpos-6.2.diff +++ b/dwm/dwm-floatpos-6.2.diff @@ -1,4 +1,4 @@ -From 125e6e3c6eff1e0a548079dfde46cd1b9836f679 Mon Sep 17 00:00:00 2001 +From f04091e9470ced452a9c64d47c1a825cf24555a3 Mon Sep 17 00:00:00 2001 From: bakkeby Date: Tue, 23 Jun 2020 11:59:12 +0200 Subject: [PATCH] floatpos: Control the size and position of floating windows @@ -9,9 +9,9 @@ of positioning new and existing floating windows. Refer to: https://github.com/bakkeby/patches/wiki/floatpos/ --- - config.def.h | 46 ++++++++++++- - dwm.c | 186 ++++++++++++++++++++++++++++++++++++++++++++++++++- - 2 files changed, 227 insertions(+), 5 deletions(-) + config.def.h | 46 +++++++++++- + dwm.c | 192 ++++++++++++++++++++++++++++++++++++++++++++++++++- + 2 files changed, 233 insertions(+), 5 deletions(-) diff --git a/config.def.h b/config.def.h index 1c0b587..8605e95 100644 @@ -85,7 +85,7 @@ index 1c0b587..8605e95 100644 TAGKEYS( XK_2, 1) TAGKEYS( XK_3, 2) diff --git a/dwm.c b/dwm.c -index 4465af1..2ef8b93 100644 +index 4465af1..d56622e 100644 --- a/dwm.c +++ b/dwm.c @@ -93,6 +93,7 @@ struct Client { @@ -165,7 +165,7 @@ index 4465af1..2ef8b93 100644 void focus(Client *c) { -@@ -871,6 +893,122 @@ getatomprop(Client *c, Atom prop) +@@ -871,6 +893,124 @@ getatomprop(Client *c, Atom prop) return atom; } @@ -271,6 +271,8 @@ index 4465af1..2ef8b93 100644 + + if (pCh == '%') // client mid-point position in relation to monitor window area size + cp = min_p + max_s * MAX(MIN(pos, 100), 0) / 100 - (cs) / 2; ++ if (pCh == 'm' || pCh == 'M') ++ cp = pos - cs / 2; + + if (!abs_p && cp < min_p) + cp = min_p; @@ -288,7 +290,7 @@ index 4465af1..2ef8b93 100644 int getrootptr(int *x, int *y) { -@@ -1029,8 +1167,10 @@ manage(Window w, XWindowAttributes *wa) +@@ -1029,8 +1169,10 @@ manage(Window w, XWindowAttributes *wa) c->w = c->oldw = wa->width; c->h = c->oldh = wa->height; c->oldbw = wa->border_width; @@ -299,7 +301,7 @@ index 4465af1..2ef8b93 100644 if (XGetTransientForHint(dpy, w, &trans) && (t = wintoclient(trans))) { c->mon = t->mon; c->tags = t->tags; -@@ -1047,7 +1187,6 @@ manage(Window w, XWindowAttributes *wa) +@@ -1047,7 +1189,6 @@ manage(Window w, XWindowAttributes *wa) /* only fix client y-offset, if the client center might cover the bar */ c->y = MAX(c->y, ((c->mon->by == c->mon->my) && (c->x + (c->w / 2) >= c->mon->wx) && (c->x + (c->w / 2) < c->mon->wx + c->mon->ww)) ? bh : c->mon->my); @@ -307,7 +309,7 @@ index 4465af1..2ef8b93 100644 wc.border_width = c->bw; XConfigureWindow(dpy, w, CWBorderWidth, &wc); -@@ -1457,6 +1596,49 @@ sendevent(Client *c, Atom proto) +@@ -1457,6 +1598,53 @@ sendevent(Client *c, Atom proto) return exists; } @@ -333,12 +335,16 @@ index 4465af1..2ef8b93 100644 + h = y; hCh = yCh; + x = 0; xCh = 'G'; + y = 0; yCh = 'G'; ++ } else if (xCh == 'm' || xCh == 'M') { ++ getrootptr(&x, &y); + } else { + w = 0; wCh = 0; + h = 0; hCh = 0; + } + break; + case 8: ++ if (xCh == 'm' || xCh == 'M') ++ getrootptr(&x, &y); + break; + default: + return;