add some blocks

This commit is contained in:
Arthur Khachaturov 2024-09-19 04:26:09 +03:00
parent e7e5ed3f64
commit 318fdf3b05
No known key found for this signature in database
GPG key ID: CAC2B7EB6DF45D55
2 changed files with 7 additions and 7 deletions

View file

@ -1,9 +1,9 @@
static const Block blocks[] = { static const Block blocks[] = {
// <i> <cmd> <int> <sig> {"", "sb-status", 30, 3},
{"", "sb-vpn", 30, 2}, {"", "sb-cast", 30, 1},
{"", "sb-cast", 30, 1}, {"", "sb-vpn", 30, 2},
{"", "sb-battery", 5, 0}, {"", "sb-battery", 5, 0},
{"", "date +'%a %m/%d %I:%M %P'", 5, 0}, {"", "date +'%a %m/%d %I:%M %P'", 5, 0},
}; };
static char delim[] = " | "; static char delim[] = " | ";

View file

@ -14,7 +14,7 @@
#define SIGMINUS SIGRTMIN #define SIGMINUS SIGRTMIN
#endif #endif
#define LENGTH(X) (sizeof(X) / sizeof (X[0])) #define LENGTH(X) (sizeof(X) / sizeof (X[0]))
#define CMDLENGTH 50 #define CMDLENGTH 512
#define MIN( a, b ) ( ( a < b) ? a : b ) #define MIN( a, b ) ( ( a < b) ? a : b )
#define STATUSLENGTH (LENGTH(blocks) * CMDLENGTH + 1) #define STATUSLENGTH (LENGTH(blocks) * CMDLENGTH + 1)
@ -72,7 +72,7 @@ void getcmd(const Block *block, char *output)
//only chop off newline if one is present at the end //only chop off newline if one is present at the end
i = output[i-1] == '\n' ? i-1 : i; i = output[i-1] == '\n' ? i-1 : i;
if (delim[0] != '\0') { if (delim[0] != '\0') {
strncpy(output+i, delim, delimLen); strncpy(output+i, delim, delimLen);
} }
else else
output[i++] = '\0'; output[i++] = '\0';