diff --git a/config.def.h b/config.def.h index 478aac7..e5c8e66 100644 --- a/config.def.h +++ b/config.def.h @@ -1,6 +1,6 @@ static const int cycletime = 2; /* time between updates in second */ static const char interface[] = "enp4s0"; /* The name of the inteface to display information for */ -static const char * icons[] = { /* Array of icons to be used for the status bar segments */ +static const char * icons[] = { /* Array of icons to be used for the status bar segments */ "", // Icon for date "", // Icon for battery "", // Icon for CPU usage @@ -12,3 +12,7 @@ static const char * icons[] = { /* Array of icons to be used for the status "", // Icon for network information "" // Icon for music infos }; + +static const unsigned int icon_color = 1; /* 1 enables colors for icons (needs DWM status2d patch */ +static const char icon_colorfg[] = "#eeeeee"; /* The foreground color for icons */ +static const char icon_colorbg[] = "#408977"; /* The background color for icons */ diff --git a/cstatbar.c b/cstatbar.c index 6c1b4ef..81bf029 100644 --- a/cstatbar.c +++ b/cstatbar.c @@ -19,33 +19,86 @@ #include "config.h" /* enums */ -enum { IconDateTime, IconBattery, IconCPU, IconRAM, IconDisk, - IconNetSpeed, IconNetSpeedUp, IconNetSpeedDown, IconNetwork, IconMusic }; +enum Icon { IconDateTime, IconBattery, IconCPU, IconRAM, IconDisk, + IconNetSpeed, IconNetSpeedUp, IconNetSpeedDown, IconNetwork, IconMusic }; /* function declaration */ +char *cs(int count, ...); +char *getnetworkspeed(); +char *makestatitem(enum Icon icon, char *val); +char *readinfile(char *filename); void setup(); void setxroot(char *title); -char *readinfile(char *filename); -char *getnetworkspeed(); -char *cs(int count, ...); /* variables */ static const char *iface; static const char kbs[] = "kb/s"; +static unsigned int ic; +static const char *icb; +static const char *icf; -/* Uses functionality from Xlib to set the window root name to a specified string */ -void setxroot(char *title) +/* a variadic function to take in count number of strings and concatenate them into one single string */ +char * cs(int count, ...) { - Display * dpy = XOpenDisplay(NULL); + va_list ap; + va_start(ap, count); + + int len = 1; + for(int i=0; i