Update statusbar

This commit is contained in:
2022-05-11 13:26:31 +02:00
parent a6876bb54e
commit 5957aa3ed4
9 changed files with 58 additions and 14 deletions

View File

@@ -1,14 +1,20 @@
//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}, */
{"", "cat /tmp/pomo", 1, 0},
{"Week ", "date '+%V'", 60, 0},
{"", "check-battery-level", 60, 0},
{"", "date '+%a %d %b %I:%M%p'", 5, 0},
{"", "task status:pending count", 20, 0}
/*
* Icon
* Command
* Update interval
* Update signal
*/
{"", "sb-date", 60, 0}, // Week, time, day
{"", "sb-pomo", 1, 0}, // Pomodoro timer
{"", "sb-tasks", 5, 0}, // Tasks done
{"", "sb-anki", 5, 0}, // Reviews done
{"", "sb-internet", 5, 0}, // Ethernet & WiFi status
{"", "sb-battery", 60, 0}, // Battery level
{"", "sb-portfolio", 600, 0} // Stocks
};
//sets delimeter between status commands. NULL character ('\0') means no delimeter.
static char delim[] = " | ";
static unsigned int delimLen = 5;
static char delim[] = " ";
static unsigned int delimLen = 0;

View File

@@ -70,11 +70,19 @@ void getcmd(const Block *block, char *output)
pclose(cmdf);
return;
}
if (delim[0] != '\0') {
//only chop off newline if one is present at the end
i = output[i-1] == '\n' ? i-1 : i;
strncpy(output+i, delim, delimLen);
}
/*
* Temporary workaround, I guess newlines caused replacement characters to be
* displayed. Removing this check and newlines from statusbar scripts does
* the trick for now. Might patch later.
*/
/* if (delim[0] != '\0') {
* //only chop off newline if one is present at the end
* i = output[i-1] == '\n' ? i-1 : i;
* strncpy(output+i, delim, delimLen);
* } */
else
output[i++] = '\0';
pclose(cmdf);