-# 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
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
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.
+++ /dev/null
-//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;
--- /dev/null
+static const Block blocks[] = {
+ // <Icon> <Command> <Update> <Interval> <Update> <Signal>
+ {"[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;
#endif
-#include "blocks.h"
+#include "config.h"
static char statusbar[LENGTH(blocks)][CMDLENGTH] = {0};
static char statusstr[2][STATUSLENGTH];