Re: [dwm] Master window width in pixels, not percent?

From: Anselm R. Garbe <arg_AT_10kloc.org>
Date: Mon, 28 Aug 2006 12:39:51 +0200

On Mon, Aug 28, 2006 at 01:30:04PM +0300, Ville Koskinen wrote:
> > Pixels don't scale in different resolutions that well (for your
> > purpose they do, but not in general). To have a 80 column
> > terminal you assume that the terminal font is never changed.
>
> Indeed, they do not scale, and I know there will be problems when the
> terminal font changes. However, it's not like I changed the font every
> week or so.
>
> > If percent is to raw, I'd be fine to change that into promille.
>
> For my setup, that won't do any good as MASTERW would still be
> proportional to the screen width...
>
> I was surprised how little needed changing to create the effect I wanted.
> It took me actually more time to make this computer run without a window
> manager than to create the modifications. (At work, kdm running, no root
> access.) Patch follows, although it's a tad inelegant to introduce
> arbitrary #defines in config.h:
>
> diff -Naru dwm-1.1/config.default.h dwm-1.1-/config.default.h
> --- dwm-1.1/config.default.h 2006-08-28 11:19:51.000000000 +0300
> +++ dwm-1.1-/config.default.h 2006-08-28 13:23:36.000000000 +0300
> @@ -20,6 +20,10 @@
>
> #define MODKEY Mod1Mask
> #define MASTERW 60 /* percent */
> +#define MASTERW_UNIT PERCENT
> +
> +#define PERCENT 0
> +#define PIXELS 1
>
> #define KEYS \
> static Key key[] = { \
> diff -Naru dwm-1.1/main.c dwm-1.1-/main.c
> --- dwm-1.1/main.c 2006-08-28 11:19:51.000000000 +0300
> +++ dwm-1.1-/main.c 2006-08-28 13:18:12.000000000 +0300
> @@ -133,7 +133,11 @@
> sx = sy = 0;
> sw = DisplayWidth(dpy, screen);
> sh = DisplayHeight(dpy, screen);
> +#if MASTERW_UNIT == PIXELS
> + mw = MASTERW;
> +#else /* default: PERCENT */
> mw = (sw * MASTERW) / 100;
> +#endif
>
> bx = by = 0;
> bw = sw;

In my eyes you don't need to introduce those defines, if you
know that MASTERW is a percent value, you can do:

#define MASTERW ((<PIXEL> * 100) / sw)

replacing <PIXEL> with the pixels you want to supply.

Regards,

-- 
 Anselm R. Garbe  ><><  www.ebrag.de  ><><  GPG key: 0D73F361
Received on Mon Aug 28 2006 - 12:39:52 UTC

This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 14:30:37 UTC