From 01acd7ea5ada0982e67e8cfbbc118d52521c4252 Mon Sep 17 00:00:00 2001 From: Armaan Bhojwani Date: Mon, 21 Jun 2021 10:59:02 -0400 Subject: [PATCH] Add customizations --- .gitignore | 54 ---------------------------------------------------- Makefile | 7 +++---- README.md | 4 ++-- blocks.def.h | 11 ----------- config.h | 11 +++++++++++ dwmblocks.c | 2 +- 6 files changed, 17 insertions(+), 72 deletions(-) delete mode 100644 blocks.def.h create mode 100644 config.h diff --git a/.gitignore b/.gitignore index b6605b4..33ba056 100644 --- a/.gitignore +++ b/.gitignore @@ -1,56 +1,2 @@ -# Custom blocks file -blocks.h - -# Prerequisites -*.d - -# Object files *.o -*.ko -*.obj -*.elf - -# Linker output -*.ilk -*.map -*.exp - -# Precompiled Headers -*.gch -*.pch - -# Libraries -*.lib -*.a -*.la -*.lo - -# Shared objects (inc. Windows DLLs) -*.dll -*.so -*.so.* -*.dylib - -# Executables -*.exe -*.out -*.app -*.i*86 -*.x86_64 -*.hex dwmblocks - -# Debug files -*.dSYM/ -*.su -*.idb -*.pdb - -# Kernel Module Compile Results -*.mod* -*.cmd -.tmp_versions/ -modules.order -Module.symvers -Mkfile.old -dkms.conf diff --git a/Makefile b/Makefile index ef43ef4..20b8862 100644 --- a/Makefile +++ b/Makefile @@ -2,16 +2,15 @@ PREFIX ?= /usr/local CC ?= cc LDFLAGS = -lX11 -output: dwmblocks.c blocks.def.h blocks.h +output: dwmblocks.c ${CC} dwmblocks.c $(LDFLAGS) -o dwmblocks -blocks.h: - cp blocks.def.h $@ - clean: rm -f *.o *.gch dwmblocks + install: output mkdir -p $(DESTDIR)$(PREFIX)/bin install -m 0755 dwmblocks $(DESTDIR)$(PREFIX)/bin/dwmblocks + uninstall: rm -f $(DESTDIR)$(PREFIX)/bin/dwmblocks diff --git a/README.md b/README.md index dda2259..3fcf353 100644 --- a/README.md +++ b/README.md @@ -5,8 +5,8 @@ To use dwmblocks first run 'make' and then install it with 'sudo make install'. After that you can put dwmblocks in your xinitrc or other startup script to have it start with dwm. # modifying blocks The statusbar is made from text output from commandline programs. -Blocks are added and removed by editing the blocks.h header file. -By default the blocks.h header file is created the first time you run make which copies the default config from blocks.def.h. +Blocks are added and removed by editing the config.h header file. +By default the config.h header file is created the first time you run make which copies the default config from blocks.def.h. This is so you can edit your status bar commands and they will not get overwritten in a future update. # patches Here are some patches to dwmblocks that add features that I either don't want to merge in, or that require a dwm patch to work. diff --git a/blocks.def.h b/blocks.def.h deleted file mode 100644 index 9c22d68..0000000 --- a/blocks.def.h +++ /dev/null @@ -1,11 +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*/ - {"Mem:", "free -h | awk '/^Mem/ { print $3\"/\"$2 }' | sed s/i//g", 30, 0}, - - {"", "date '+%b %d (%a) %I:%M%p'", 5, 0}, -}; - -//sets delimeter between status commands. NULL character ('\0') means no delimeter. -static char delim[] = " | "; -static unsigned int delimLen = 5; diff --git a/config.h b/config.h new file mode 100644 index 0000000..bb4903a --- /dev/null +++ b/config.h @@ -0,0 +1,11 @@ +static const Block blocks[] = { + // + {"[BAT: ", "awk '{print $1 \"%]\"}' /sys/class/power_supply/BAT0/capacity ", 15, 0}, + {"[VOL: ", "amixer sget Master | awk -F'[][]' '/dB/ { print $2 \", \" $6 \"]\"}'", 15, 10}, + {"[DAT: ", "date '+%A %Y-%m-%d %I:%M:%S %p]'", 1, 0}, +}; + +/* sets delimeter between status commands. NULL character ('\0') means + * no delimeter. */ +static char delim[] = " "; +static unsigned int delimLen = 1; diff --git a/dwmblocks.c b/dwmblocks.c index ded717c..667a8e4 100644 --- a/dwmblocks.c +++ b/dwmblocks.c @@ -48,7 +48,7 @@ static void (*writestatus) () = pstdout; #endif -#include "blocks.h" +#include "config.h" static char statusbar[LENGTH(blocks)][CMDLENGTH] = {0}; static char statusstr[2][STATUSLENGTH]; -- 2.39.2