You are not logged in.

#1 2014-03-04 21:32:33

KD0SKH
Member
Registered: 2013-05-31
Posts: 16
Website

Patching dwm-statuscolors won't work

I use dwm/dmenu. I currently have a script in my .xinitrc that checks things like the internet connection, battery, date, etc and outputs this as a string via

 xsetroot -name "` echo -e ${STATUS}`" 

where STATUS is just the concatenation of various items that are being updated. The script I am using is shown below:

while true; do
  #This section is for displaying the state of the battery
  batt=$(LC_ALL=C acpi -b)
  case $batt in
  *Discharging*)
    batt="${batt#* * * }"
    batt="${batt%%, *}-"
    ;;
  *)#charging
    batt="${batt#* * * }"
    batt="${batt%%, *}+"
  ;;
esac

#This section is for displaying network stuff
wln=$(LC_ALL=C ip  address show wlan0)
eth=$(LC_ALL=C ip address show eth0)
case $eth in
  *DOWN*)
    eth_ipv4=""
  case $wln in
    *DOWN*)
      wln_ipv4="[NO INTERNET]"
    ;;
    *UP*)
      wln_ipv4=IP:\ [w:$(ifconfig wlan0 | grep 'inet ' | sed s/inet// | sed s/ netmask\*.*.//|sed 's/^[ \t]*//'|sed 's/[ \t]*$//')]
    ;;
  esac
  ;;
  *UP*)
    eth_ipv4=IP:\ [e:$(ifconfig eth0 | grep 'inet ' | sed s/inet// | sed s/    netmask\*.*.//|sed 's/^[ \t]*//'|sed 's/[ \t]*$//')]
  case $wln in
    *DOWN*)
      wln_ipv4="[!w] "
    ;;
    *UP*)
      wln_ipv4=""
    ;;
  esac
  ;;
esac

STATUS="${wln_ipv4}${eth_ipv4} :: Battery: ${batt} :: $(date +%a\ %m.%d.%y\ :: \ %R)

This works exactly as I need it, but I wanted to add color. Since I am running the latest version of dwm (6.0), I sought out the latest patch for statuscolors. I got this patch from here and placed it in my dwm directory using curl.

So here is where my problems begin. I used the following command

git apply --ignore-whitespace --ignore-space-change ../../statuscolours.patch

Outputs:

src/dwm-6.0/../../statuscolours.patch:17: trailing whitespace.
#define NUMCOLORS 9 
warning: 1 line adds whitespace errors.

Now, I decided to try this on a vanilla copy of dwm-git. It output something different:

#define NUMCOLORS 9 
Checking patch config.def.h...
error: while searching for:
#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 };

static Key keys[] = {
	/* modifier                     key        function        argument */
	{ MODKEY,                       XK_p,      spawn,          {.v = dmenucmd } },
	{ MODKEY|ShiftMask,             XK_Return, spawn,          {.v = termcmd } },
	{ MODKEY,                       XK_b,      togglebar,      {0} },
	{ MODKEY,                       XK_j,      focusstack,     {.i = +1 } },
	{ MODKEY,                       XK_k,      focusstack,     {.i = -1 } },

error: patch failed: config.def.h:50
error: config.def.h: patch does not apply
Checking patch dwm.c...
error: while searching for:
#define LENGTH(X)               (sizeof X / sizeof X[0])
#define MAX(A, B)               ((A) > (B) ? (A) : (B))
#define MIN(A, B)               ((A) < (B) ? (A) : (B))
#define MOUSEMASK               (BUTTONMASK|PointerMotionMask)
#define WIDTH(X)                ((X)->w + 2 * (X)->bw)
#define HEIGHT(X)               ((X)->h + 2 * (X)->bw)

error: patch failed: dwm.c:51
error: dwm.c: patch does not apply

What can I do to get this patch to work?

Offline

Board footer

Powered by FluxBB