dwmblocks

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit b9e29ebe901e41e777aaa4be00b808ca655697cf
parent 6bd2e845be1f4efe089ec3f4d0fea82c93a515bb
Author: Luke Smith <luke@lukesmith.xyz>
Date:   Sun,  1 Mar 2020 07:01:56 -0500

blocks.h moved to config.h

Diffstat:
MMakefile | 4++--
Dblocks.h | 17-----------------
Aconfig.h | 19+++++++++++++++++++
Mdwmblocks.c | 10+++++-----
4 files changed, 26 insertions(+), 24 deletions(-)

diff --git a/Makefile b/Makefile @@ -1,7 +1,7 @@ output: dwmblocks.o gcc dwmblocks.o -lX11 -o dwmblocks -dwmblocks.o: dwmblocks.c blocks.h - gcc -c -lX11 dwmblocks.c +dwmblocks.o: dwmblocks.c config.h + gcc -c -lX11 dwmblocks.c clean: rm *.o *.gch dwmblocks install: output diff --git a/blocks.h b/blocks.h @@ -1,17 +0,0 @@ -//Modify this file to change what commands output to your statusbar, and recompile using the make command. -static const Block blocks[] = { - /*Icon*/ /*Command*/ /*Update Interval*/ /*Update Signal*/ - /* {"", "cat /tmp/recordingicon", 0, 9}, */ - /* {"", "music", 0, 11}, */ - {"", "pacpackages", 0, 8}, - {"", "torrent", 20, 7}, - {"", "news", 0, 6}, - {"", "weather", 18000, 5}, - {"", "mailbox", 180, 12}, - {"", "volume", 0, 10}, - {"", "battery", 5, 0}, - {"", "clock", 60, 0}, -}; - -//sets delimeter between status commands. NULL character ('\0') means no delimeter. -static char delim = '|'; diff --git a/config.h b/config.h @@ -0,0 +1,19 @@ +//Modify this file to change what commands output to your statusbar, and recompile using the make command. +static const Block blocks[] = { + /*Icon*/ /*Command*/ /*Update Interval*/ /*Update Signal*/ + /* {"", "cat /tmp/recordingicon", 0, 9}, */ + /* {"", "music", 0, 11}, */ + {"", "pacpackages", 0, 8}, + {"", "crypto", 0, 13}, + {"", "torrent", 20, 7}, + {"", "news", 0, 6}, + /* {"", "moonphase", 18000, 5}, */ + {"", "weather", 18000, 5}, + {"", "mailbox", 180, 12}, + {"", "volume", 0, 10}, + {"", "battery", 5, 0}, + {"", "clock", 60, 0}, +}; + +//sets delimeter between status commands. NULL character ('\0') means no delimeter. +static char delim = '|'; diff --git a/dwmblocks.c b/dwmblocks.c @@ -25,7 +25,7 @@ void sighandler(int signum); void termhandler(int signum); -#include "blocks.h" +#include "config.h" static Display *dpy; static int screen; @@ -69,7 +69,7 @@ void getcmds(int time) { const Block* current; for(int i = 0; i < LENGTH(blocks); i++) - { + { current = blocks + i; if ((current->interval != 0 && time % current->interval == 0) || time == -1) getcmd(current,statusbar[i]); @@ -90,7 +90,7 @@ void getsigcmds(int signal) void setupsignals() { for(int i = 0; i < LENGTH(blocks); i++) - { + { if (blocks[i].signal > 0) signal(SIGRTMIN+blocks[i].signal, sighandler); } @@ -101,7 +101,7 @@ void getstatus(char *str) { int j = 0; for(int i = 0; i < LENGTH(blocks); j+=strlen(statusbar[i++])) - { + { strcpy(str + j, statusbar[i]); } str[--j] = '\0'; @@ -157,7 +157,7 @@ void termhandler(int signum) int main(int argc, char** argv) { for(int i = 0; i < argc; i++) - { + { if (!strcmp("-d",argv[i])) delim = argv[++i][0]; }