From b714329d87440124afa905e14126a8896b1c7109 Mon Sep 17 00:00:00 2001 From: bakkeby Date: Fri, 28 Aug 2020 18:17:09 +0200 Subject: [PATCH] floatpos: Adding m option to spawn floating clients where the mouse pointer is --- patch/floatpos.c | 7 +++++++ 1 file changed, 7 insertions(+) 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;