aewl
diff aewl.c @ 787:eecb13b34511
Put floating windows on random starting positions
author | markus schnalke <meillo@marmaro.de> |
---|---|
date | Fri, 18 Oct 2024 23:42:20 +0200 |
parents | e65be4ffdbdc |
children |
line diff
1.1 --- a/aewl.c Thu Jun 14 00:00:00 2012 +0200 1.2 +++ b/aewl.c Fri Oct 18 23:42:20 2024 +0200 1.3 @@ -1188,8 +1188,12 @@ 1.4 c = emallocz(sizeof(Client)); 1.5 c->tag = True; 1.6 c->win = w; 1.7 - c->x = wa->x; 1.8 - c->y = wa->y; 1.9 + if (wa->width < sw) { 1.10 + c->x = rand() % (sw - wa->width); 1.11 + } 1.12 + if (wa->height < sh) { 1.13 + c->y = rand() % (sh - wa->height); 1.14 + } 1.15 c->w = wa->width; 1.16 c->h = wa->height; 1.17 if(c->w == sw && c->h == sh) { 1.18 @@ -1277,6 +1281,10 @@ 1.19 c->border = 0; 1.20 else 1.21 c->border = BORDERPX; 1.22 + /* move outside window back to original place */ 1.23 + if(c->x > sw) { 1.24 + c->x -= 2 * sw; 1.25 + } 1.26 /* offscreen appearance fixes */ 1.27 if(c->x > sw) 1.28 c->x = sw - c->w - 2 * c->border;