removed icons in setup, increased max length

This commit is contained in:
Alexander Bocken 2020-08-23 17:03:09 +02:00
parent 0a171e708c
commit bf7d745a73
2 changed files with 22 additions and 20 deletions

View File

@ -1,19 +1,24 @@
//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*/
{"", "music", 3600, 11},
{"", "cat /tmp/mucc_time", 100, 3},
{"", "getpomminutesft", 100, 3},
{"", "getpomminutes", 100, 3},
/* {"", "weather", 3600, 5},*/
{"", "cpu", 5, 0},
{"", "getmail", 20, 13},
{"", "news", 600, 13},
{"", "getbright", 4, 2},
{"", "volume", 1, 10},
{"", "clock", 10, 0},
{"", "internet", 10, 0},
{"music", 3600, 11},
{"cat /tmp/mucc_time 2> /dev/null", 100, 3},
{"getpomminutesft", 100, 3},
{"getpomminutes", 100, 3},
/* {"weather", 3600, 5},*/
{"pacpackages", 100, 0},
{"cpu", 5, 0},
// {"nettraf", 10, 0},
{"torrent", 6, 0},
{"getmail", 20, 13},
{"news", 600, 13},
{"getbright", 4, 2},
{"headset_connected", 5, 4},
{"volume", 1, 10},
{"current_day", 100, 0},
{"clock", 4, 0},
{"internet", 10, 0},
};
//sets delimeter between status commands. NULL character ('\0') means no delimeter.
static char delim = '|';
static char delim = ' ';

View File

@ -5,10 +5,9 @@
#include<signal.h>
#include<X11/Xlib.h>
#define LENGTH(X) (sizeof(X) / sizeof (X[0]))
#define CMDLENGTH 50
#define CMDLENGTH 100
typedef struct {
char* icon;
char* command;
unsigned int interval;
unsigned int signal;
@ -34,7 +33,7 @@ static Display *dpy;
static int screen;
static Window root;
static char statusbar[LENGTH(blocks)][CMDLENGTH] = {0};
static char statusstr[2][256];
static char statusstr[2][512];
static int statusContinue = 1;
static void (*writestatus) () = setroot;
@ -49,15 +48,13 @@ void replace(char *str, char old, char new)
//opens process *cmd and stores output in *output
void getcmd(const Block *block, char *output)
{
strcpy(output, block->icon);
char *cmd = block->command;
FILE *cmdf = popen(cmd,"r");
if (!cmdf)
return;
char c;
int i = strlen(block->icon);
fgets(output+i, CMDLENGTH-i, cmdf);
i = strlen(output);
fgets(output, CMDLENGTH, cmdf);
int i = strlen(output);
if (delim != '\0' && --i)
output[i++] = delim;
output[i++] = '\0';