Re: [dwm] Help with grid layout

From: Donald Chai <donald.chai_AT_gmail.com>
Date: Sun, 28 Sep 2008 15:41:23 -0700

On Sep 28, 2008, at 12:37 PM, Valentin wrote:

> Hi,
>
> can somebody tell me how to change the latest grid layout patch to put
> the clients in two columns and one row instead of two rows and one
> column when there are only two clients in a tag? [1] The current
> way of
> doing it isn't very nice on widescreen monitors...

Change the follow block in grid():
+ /* grid dimensions */
+ for(rows = 0; rows <= n/2; rows++)
+ if(rows*rows >= n)
+ break;
+ cols = (rows && (rows - 1) * rows >= n) ? rows - 1 : rows;

Where it says 'rows', it should say 'cols', and vice versa. But
really, this also sucks if you have 100 windows, as it forces a 10x10
grid regardless of screen dimensions. Something like:
        k = some constant, maybe mfact?
        rows = (int) floor(sqrt(n * k));
        cols = (int) ceil((double) n / rows);
is both cleaner and more general, IMHO.
Received on Sun Sep 28 2008 - 22:41:23 UTC

This archive was generated by hypermail 2.2.0 : Sun Sep 28 2008 - 22:48:03 UTC