summaryrefslogtreecommitdiffhomepage
path: root/patch/floatpos.c
diff options
context:
space:
mode:
authorbakkeby <[email protected]>2020-08-28 18:17:09 +0200
committerbakkeby <[email protected]>2020-08-28 18:17:09 +0200
commitb714329d87440124afa905e14126a8896b1c7109 (patch)
treec594b70e8bbf517cdea3d1538af0dd04111e6425 /patch/floatpos.c
parent82c3984b2d11dd543ec4738d7450abfc35347efd (diff)
downloaddwm-flexipatch-b714329d87440124afa905e14126a8896b1c7109.tar.gz
dwm-flexipatch-b714329d87440124afa905e14126a8896b1c7109.zip
floatpos: Adding m option to spawn floating clients where the mouse pointer is
Diffstat (limited to 'patch/floatpos.c')
-rw-r--r--patch/floatpos.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/patch/floatpos.c b/patch/floatpos.c
index 1cdfcbb..5d3947a 100644
--- a/patch/floatpos.c
+++ b/patch/floatpos.c
@@ -29,6 +29,7 @@ setfloatpos(Client *c, const char *floatpos)
return;
if (selmon->lt[selmon->sellt]->arrange && !c->isfloating)
return;
+
switch(sscanf(floatpos, "%d%c %d%c %d%c %d%c", &x, &xCh, &y, &yCh, &w, &wCh, &h, &hCh)) {
case 4:
if (xCh == 'w' || xCh == 'W') {
@@ -41,12 +42,16 @@ setfloatpos(Client *c, const char *floatpos)
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;
@@ -173,6 +178,8 @@ getfloatpos(int pos, char pCh, int size, char sCh, int min_p, int max_s, int cp,
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;