]> git.armaanb.net Git - dwmblocks.git/commitdiff
Add customizations
authorArmaan Bhojwani <me@armaanb.net>
Mon, 21 Jun 2021 14:59:02 +0000 (10:59 -0400)
committerArmaan Bhojwani <me@armaanb.net>
Mon, 21 Jun 2021 15:03:31 +0000 (11:03 -0400)
.gitignore
Makefile
README.md
blocks.def.h [deleted file]
config.h [new file with mode: 0644]
dwmblocks.c

index b6605b413074a4a711c2e4bcdb0a109412d50434..33ba056a82a4083edec4a656d702a93c4e353325 100644 (file)
@@ -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
index ef43ef4f1f8bbb8fc84f6e0d6d1b558a59203711..20b88629312cf1ab4fede8b4574c2572ebce3a37 100644 (file)
--- 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
index dda2259b5c403848bac13bff156258c199952145..3fcf353fef88c4978b03708b42777c34f54d4dde 100644 (file)
--- 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 (file)
index 9c22d68..0000000
+++ /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 (file)
index 0000000..bb4903a
--- /dev/null
+++ b/config.h
@@ -0,0 +1,11 @@
+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;
index ded717c197508c0453a36a562e82574fccb8ef49..667a8e4901ca6e873ebd3a2a7db9dd4ce4e11ef1 100644 (file)
@@ -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];