Re: [dwm] CLI color/font override patch

From: Jeremy Jay <dinkumator_AT_gmail.com>
Date: Tue, 24 Feb 2009 14:05:21 -0500

Do you really change your font/colors that often?

If you want to avoid the compile I'm sure it'd be
just as easy to use a hex-editor on the strings.

Jeremy

On Tue 24 Feb 2009 - 01:34PM, Ian Daniher wrote:
> Hi All,
> Eager to avoid the excessive recompiling of dwm on a 433mhz proc(takes
> ~25seconds), I sought to patch dwm to support "-fn" and other appearance
> changes.
> I've attached two patches, one for dwm.c and one for config.def.h.
> The code I put together is based heavily off dmenu's arg processing and adds
> a little less than thirty SLOCs.
> The patch for config.def.h adds no SLOCs.
> Best,
> --
> Ian Daniher

> 4,10c4,10
> < static const char *font = "-*-terminus-medium-r-normal-*-14-*-*-*-*-*-*-*";
> < static const char *normbordercolor = "#cccccc";
> < static const char *normbgcolor = "#cccccc";
> < static const char *normfgcolor = "#000000";
> < static const char *selbordercolor = "#0066ff";
> < static const char *selbgcolor = "#0066ff";
> < static const char *selfgcolor = "#ffffff";
> ---
> > static const char font[] = "-*-terminus-medium-r-normal-*-14-*-*-*-*-*-*-*";
> > static const char normbordercolor[] = "#cccccc";
> > static const char normbgcolor[] = "#cccccc";
> > static const char normfgcolor[] = "#000000";
> > static const char selbordercolor[] = "#0066ff";
> > static const char selbgcolor[] = "#0066ff";
> > static const char selfgcolor[] = "#ffffff";
> 48c48,52
> < #define BASHCMD(cmd) { .v = (const char*[]){ "/bin/bash", "-c", cmd, NULL } }
> ---
> > #define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } }
> >
> > /* commands */
> > static const char *dmenucmd[] = { "dmenu_run", "-fn", font, "-nb", normbgcolor, "-nf", normfgcolor, "-sb", selbgcolor, "-sf", selfgcolor, NULL };
> > static const char *termcmd[] = { "uxterm", NULL };
> 52,53c56,57
> < { MODKEY, XK_p, spawn, BASHCMD("launcher dmenu") },
> < { MODKEY|ShiftMask, XK_Return, spawn, BASHCMD("launcher uxterm") },
> ---
> > { MODKEY, XK_p, spawn, {.v = dmenucmd } },
> > { MODKEY|ShiftMask, XK_Return, spawn, {.v = termcmd } },
> 88a93
> > { ClkStatusText, 0, Button2, spawn, {.v = termcmd } },

> 1710,1713c1710,1737
> < if(argc == 2 && !strcmp("-v", argv[1]))
> < die("dwm-"VERSION", ?? 2006-2009 dwm engineers, see LICENSE for details\n");
> < else if(argc != 1)
> < die("usage: dwm [-v]\n");
> ---
> > unsigned int i;
> > for(i = 1; i < argc; i++)
> > if(!strcmp(argv[i], "-fn")) {
> > if(++i < argc) font = argv[i];
> > }
> > else if(!strcmp(argv[i], "-nb")) {
> > if(++i < argc) normbgcolor = argv[i];
> > }
> > else if(!strcmp(argv[i], "-nf")) {
> > if(++i < argc) normfgcolor = argv[i];
> > }
> > else if(!strcmp(argv[i], "-sb")) {
> > if(++i < argc) selbgcolor = argv[i];
> > }
> > else if(!strcmp(argv[i], "-sf")) {
> > if(++i < argc) selfgcolor = argv[i];
> > }
> > else if(!strcmp(argv[i], "-nd")) {
> > if(++i < argc) normbordercolor = argv[i];
> > }
> > else if(!strcmp(argv[i], "-sd")) {
> > if(++i < argc) selbordercolor = argv[i];
> > }
> > else if(!strcmp(argv[i], "-v"))
> > die("dwm-"VERSION", ?? 2006-2008 dwm engineers, see LICENSE for details\n");
> > else
> > die("usage: dwm [-fn <font>] [-nb <color>] [-nf <color>]\n"
> > "[-v] [-sb <color>] [-sf <color>] [-nd <color>] [-sd <color>]\n");
Received on Tue Feb 24 2009 - 19:05:21 UTC

This archive was generated by hypermail 2.2.0 : Tue Feb 24 2009 - 19:12:04 UTC