From 5761a9018fb6baca698f5c4fe3b424813adf8316 Mon Sep 17 00:00:00 2001 From: Ashish Kumar Yadav Date: Sat, 6 Mar 2021 03:15:24 +0530 Subject: [PATCH] Implemented config.def.h - config.h setup --- .gitignore | 1 + GNUmakefile | 10 ++++++++++ README.md | 10 +++++----- config.h => config.def.h | 2 +- 4 files changed, 17 insertions(+), 6 deletions(-) rename config.h => config.def.h (96%) diff --git a/.gitignore b/.gitignore index 44fdadb..02e57be 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +config.h dwmblocks sigdwmblocks/sigdwmblocks xgetrootname/xgetrootname diff --git a/GNUmakefile b/GNUmakefile index 97cb86f..b97eccd 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -11,6 +11,16 @@ all: dwmblocks sigdwmblocks/sigdwmblocks xgetrootname/xgetrootname dwmblocks: dwmblocks.c config.h block.h ${CC} -o $@ -Wno-missing-field-initializers -Wno-unused-parameter ${CFLAGS} ${X11CFLAGS} $< ${X11LIBS} +E0BLOCKS = $(abspath blocks) +# two level escaping of '\', one for sed and one for C +E1BLOCKS = $(subst \,\\\\,${E0BLOCKS}) +# escaping special character '&' and delimiter '=' for sed +E2BLOCKS = $(subst &,\&,${E1BLOCKS}) +EFBLOCKS = $(subst =,\=,${E2BLOCKS}) + +config.h: + sed '2s==${EFBLOCKS}=' config.def.h >$@ + sigdwmblocks/sigdwmblocks: sigdwmblocks/sigdwmblocks.c ${CC} -o $@ ${CFLAGS} $< diff --git a/README.md b/README.md index cc37518..2678ae9 100644 --- a/README.md +++ b/README.md @@ -7,13 +7,13 @@ signaling, clickability, cursor hinting and color. `dwmblocks` -# Modifying blocks +# Configuration -Blocks are added and removed by editing [config.h](config.h) file. Some other -configurations can also be done through the file. Read it for more info. +Refer to [config.h](config.def.h). It allows addition/removal of blocks and a +few other configurations. -> Change the PATH macro defined at the top of the file. It should point to the -> folder where your scripts are saved. +> `make`, the first time you run it, or `make config.h` will create config.h by +> copying [config.def.h](config.def.h). > The provided blocks use siji font for icons. diff --git a/config.h b/config.def.h similarity index 96% rename from config.h rename to config.def.h index 66faa25..59c268d 100644 --- a/config.h +++ b/config.def.h @@ -1,5 +1,5 @@ /* macro for conveniently specifying pathu and pathc below */ -#define PATH(name) "/home/ashish/.local/projects/dwmblocks/blocks/"name +#define PATH(name) "/"name /* buffer size for capturing output of the programs used for updating blocks */ #define CMDOUTLENGTH 50