Implemented config.def.h - config.h setup

This commit is contained in:
Ashish Kumar Yadav 2021-03-06 03:15:24 +05:30
parent a9b458c56c
commit 5761a9018f
4 changed files with 17 additions and 6 deletions

1
.gitignore vendored
View file

@ -1,3 +1,4 @@
config.h
dwmblocks
sigdwmblocks/sigdwmblocks
xgetrootname/xgetrootname

View file

@ -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=<path to the folder containing block scripts>=${EFBLOCKS}=' config.def.h >$@
sigdwmblocks/sigdwmblocks: sigdwmblocks/sigdwmblocks.c
${CC} -o $@ ${CFLAGS} $<

View file

@ -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.

View file

@ -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) "<path to the folder containing block scripts>/"name
/* buffer size for capturing output of the programs used for updating blocks */
#define CMDOUTLENGTH 50