summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config.h44
-rw-r--r--dwmblocks.c29
2 files changed, 35 insertions, 38 deletions
diff --git a/config.h b/config.h
index ec4ff6e..8bd92b9 100644
--- a/config.h
+++ b/config.h
@@ -1,36 +1,16 @@
//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*/
- /* {"⌨", "sb-kbselect", 0, 30}, */
- {"", "cat /tmp/recordingicon 2>/dev/null", 0, 9},
- {"", "sb-tasks", 10, 26},
- {"", "sb-music", 0, 11},
- {"", "sb-pacpackages", 0, 8},
- {"", "sb-news", 0, 6},
- /* {"", "sb-price lbc \"LBRY Token\" 📚", 9000, 22}, */
- /* {"", "sb-price bat \"Basic Attention Token\" 🦁", 9000, 20}, */
- /* {"", "sb-price link \"Chainlink\" 🔗", 300, 25}, */
- /* {"", "sb-price xmr \"Monero\" 🔒", 9000, 24}, */
- /* {"", "sb-price eth Ethereum 🍸", 9000, 23}, */
- /* {"", "sb-price btc Bitcoin 💰", 9000, 21}, */
- {"", "sb-torrent", 20, 7},
- /* {"", "sb-memory", 10, 14}, */
- /* {"", "sb-cpu", 10, 18}, */
- /* {"", "sb-moonphase", 18000, 17}, */
- {"", "sb-forecast", 18000, 5},
- {"", "sb-mailbox", 180, 12},
- {"", "sb-nettraf", 1, 16},
- {"", "sb-volume", 0, 10},
- {"", "sb-battery", 5, 3},
- {"", "sb-clock", 60, 1},
- {"", "sb-internet", 5, 4},
- {"", "sb-help-icon", 0, 15},
+ /* {"", "music", 0, 11},*/
+ /* {"", "pacpackages", 0, 8}, */
+ /* {"", "memory", 10, 14}, */
+ /* {"", "weather", 18000, 5}, */
+ /* {"", "mailbox", 180, 12}, */
+ /* {"", "nettraf", 1, 16}, */
+ /* {"", "volume", 0, 10}, */
+ /* {"", "internet", 5, 4}, */
+ {"", "stalonetray.sh", 0, 27},
+ {"", "cpupercent.sh", 1, 19},
+ {"", "battery", 5, 3},
+ {"", "clock", 1, 1},
};
-
-//Sets delimiter between status commands. NULL character ('\0') means no delimiter.
-static char *delim = " ";
-
-// Have dwmblocks automatically recompile and run when you edit this file in
-// vim with the following line in your vimrc/init.vim:
-
-// autocmd BufWritePost ~/.local/src/dwmblocks/config.h !cd ~/.local/src/dwmblocks/; sudo make install && { killall -q dwmblocks;setsid dwmblocks & }
diff --git a/dwmblocks.c b/dwmblocks.c
index 18f58fb..26ca6b0 100644
--- a/dwmblocks.c
+++ b/dwmblocks.c
@@ -2,6 +2,7 @@
#include<stdio.h>
#include<string.h>
#include<unistd.h>
+#include <time.h>
#include<signal.h>
#include<X11/Xlib.h>
#define LENGTH(X) (sizeof(X) / sizeof (X[0]))
@@ -91,8 +92,9 @@ void getcmds(int time)
for(int i = 0; i < LENGTH(blocks); i++)
{
current = blocks + i;
- if ((current->interval != 0 && time % current->interval == 0) || time == -1)
+ if ((current->interval != 0 && time % current->interval == 0) || time == -1){
getcmd(current,statusbar[i]);
+ }
}
}
@@ -103,8 +105,9 @@ void getsigcmds(int signal)
for (int i = 0; i < LENGTH(blocks); i++)
{
current = blocks + i;
- if (current->signal == signal)
+ if (current->signal == signal){
getcmd(current,statusbar[i]);
+ }
}
}
@@ -177,13 +180,27 @@ void statusloop()
setupsignals();
#endif
int i = 0;
+ int previ = -1;
+ int gotscrewed = 0;
+ struct timespec sleeptime = {1, 0};
+ struct timespec left;
getcmds(-1);
while(statusContinue)
{
- getcmds(i);
- writestatus();
- sleep(1.0);
- i++;
+ if(i != previ){
+ getcmds(i);
+ writestatus();
+ }
+ gotscrewed = nanosleep(&sleeptime, &left);
+ previ = i;
+ /* long diff = (left.tv_sec + (left.tv_nsec + 500000000l) / 1000000000l); */
+ /* i += 1 - diff; */
+ if(gotscrewed != -1){
+ i++;
+ /* }else{ */
+ /* printf("sec and nanosec left: %d, %d", left.tv_sec, left.tv_nsec); */
+ }
+
}
}
Software created with 💖