# HG changeset patch # User markus schnalke # Date 1729287740 -7200 # Node ID eecb13b34511d2b5626344f6470ffe277fa83022 # Parent e65be4ffdbdc2437b8fa922133520ee52afe7054 Put floating windows on random starting positions diff -r e65be4ffdbdc -r eecb13b34511 aewl.c --- a/aewl.c Thu Jun 14 00:00:00 2012 +0200 +++ b/aewl.c Fri Oct 18 23:42:20 2024 +0200 @@ -1188,8 +1188,12 @@ c = emallocz(sizeof(Client)); c->tag = True; c->win = w; - c->x = wa->x; - c->y = wa->y; + if (wa->width < sw) { + c->x = rand() % (sw - wa->width); + } + if (wa->height < sh) { + c->y = rand() % (sh - wa->height); + } c->w = wa->width; c->h = wa->height; if(c->w == sw && c->h == sh) { @@ -1277,6 +1281,10 @@ c->border = 0; else c->border = BORDERPX; + /* move outside window back to original place */ + if(c->x > sw) { + c->x -= 2 * sw; + } /* offscreen appearance fixes */ if(c->x > sw) c->x = sw - c->w - 2 * c->border;