exit(0);
}
+#if defined(__linux__)
+int post_21_kernel;
+#endif /* __linux__ */
+
#ifdef X11
/*
static int border_margin, border_width;
static long default_fg_color, default_bg_color, default_out_color;
-static long color0, color1, color2, color3, color4, color5, color6, color7, color8, color9;
/* create own window or draw stuff to root? */
static int set_transparent = 0;
static int sensor_device;
#endif
+static long color0, color1, color2, color3, color4, color5, color6, color7, color8, color9;
+
/* maximum number of special things, e.g. fonts, offsets, aligns, etc. */
static unsigned int max_specials = MAX_SPECIALS_DEFAULT;
static int if_jumped = 0;
static int blockstart[MAX_IF_BLOCK_DEPTH];
-int check_mount(char *s)
-{
-#if defined(__linux__)
- int ret = 0;
- FILE *mtab = fopen("/etc/mtab", "r");
- if (mtab) {
- char buf1[256], buf2[128];
- while (fgets(buf1, 256, mtab)) {
- sscanf(buf1, "%*s %128s", buf2);
- if (!strcmp(s, buf2)) {
- ret = 1;
- break;
- }
- }
- fclose(mtab);
- } else {
- ERR("Could not open mtab");
- }
- return ret;
-#elif defined(__FreeBSD__)
- struct statfs *mntbuf;
- int i, mntsize;
-
- mntsize = getmntinfo(&mntbuf, MNT_NOWAIT);
- for (i = mntsize - 1; i >= 0; i--)
- if (strcmp(mntbuf[i].f_mntonname, s) == 0)
- return 1;
-
- return 0;
-#elif defined(__OpenBSD__)
- /* stub */
- return 0;
-#endif
-}
-
-
int check_contains(char *f, char *s)
{
int ret = 0;
{
if (args && *args)
return strdup(args);
- }
+
return NULL;
}
OBJ_pb_battery,
OBJ_voltage_mv,
OBJ_voltage_v,
+ OBJ_wireless_essid,
+ OBJ_wireless_mode,
+ OBJ_wireless_bitrate,
+ OBJ_wireless_link_qual,
+ OBJ_wireless_link_qual_max,
+ OBJ_wireless_link_bar,
+ OBJ_wireless_ap,
#endif /* __linux__ */
OBJ_if_empty,
OBJ_if_existing,
free(objs[i].data.tail.logfile);
free(objs[i].data.tail.buffer);
break;
- case OBJ_text: case OBJ_font:
+ case OBJ_text:
+ case OBJ_font:
free(objs[i].data.s);
break;
case OBJ_image:
obj->data.cpu_index=atoi(&arg[0]);
}
obj->a = 1;
+
+#ifdef HAVE_IWLIB
+ END OBJ(wireless_essid, INFO_NET)
+ if(arg)
+ obj->data.net = get_net_stat(arg);
+ else
+ CRIT_ERR("wireless_essid: needs an argument");
+ END OBJ(wireless_mode, INFO_NET)
+ if(arg)
+ obj->data.net = get_net_stat(arg);
+ else
+ CRIT_ERR("wireless_mode: needs an argument");
+ END OBJ(wireless_ap, INFO_NET)
+ if(arg)
+ obj->data.net = get_net_stat(arg);
+ else
+ CRIT_ERR("wireless_ap: needs an argument");
+ END OBJ(wireless_bitrate, INFO_NET)
+ if(arg)
+ obj->data.net = get_net_stat(arg);
+ else
+ CRIT_ERR("wireless_bitrate: needs an argument");
+ END OBJ(wireless_link_qual, INFO_NET)
+ if(arg)
+ obj->data.net = get_net_stat(arg);
+ else
+ CRIT_ERR("wireless_link_qual: needs an argument");
+ END OBJ(wireless_link_qual_max, INFO_NET)
+ if(arg)
+ obj->data.net = get_net_stat(arg);
+ else
+ CRIT_ERR("wireless_link_qual_max: needs an argument");
+ END OBJ(wireless_link_bar, INFO_NET)
+ if(arg) {
+ arg = scan_bar(arg, &obj->a, &obj->b);
+ obj->data.net = get_net_stat(arg);
+ } else
+ CRIT_ERR("wireless_link_bar: needs an argument");
+#endif /* HAVE_IWLIB */
+
#endif /* __linux__ */
END OBJ(freq_dyn, 0);
END OBJ(freq_dyn_g, 0);
} else {
strcpy(bat, "BAT0");
}
+ obj->data.s = strdup(bat);
#if defined(__linux__)
END OBJ(i8k_version, INFO_I8K)
END OBJ(i8k_bios, INFO_I8K)
obj->data.l = color9;
END OBJ(font, 0)
obj->data.s = scan_font(arg);
- END
- OBJ(downspeed, INFO_NET)
+ END OBJ(downspeed, INFO_NET)
if(arg) {
obj->data.net = get_net_stat(arg);
}
else {
CRIT_ERR("addr needs argument");
}
+#if 0
END OBJ(linkstatus, INFO_WIFI)
if(arg) {
obj->data.net = get_net_stat(arg);
else {
CRIT_ERR("linkstatus needs argument");
}
+#endif
END OBJ(tail, 0)
char buf[64];
int n1, n2;
}
END
#ifdef MPD
- OBJ(mpd_artist, INFO_MPD)
- END OBJ(mpd_title, INFO_MPD)
+ OBJ(mpd_artist, INFO_MPD) END
+ OBJ(mpd_title, INFO_MPD)
+ {
+ if (arg)
+ {
+ sscanf (arg, "%d", &info.mpd.max_title_len);
+ if (info.mpd.max_title_len > 0)
+ info.mpd.max_title_len++;
+ else
+ CRIT_ERR ("mpd_title: invalid length argument");
+ }
+ }
END OBJ(mpd_random, INFO_MPD)
END OBJ(mpd_repeat, INFO_MPD)
END OBJ(mpd_elapsed, INFO_MPD)
obj->a = get_voltage(p, p_max_size, "%'.3f", 1000, obj->data.cpu_index);
}
}
+#ifdef HAVE_IWLIB
+ OBJ(wireless_essid) {
+ snprintf(p, p_max_size, "%s", obj->data.net->essid);
+ }
+ OBJ(wireless_mode) {
+ snprintf(p, p_max_size, "%s", obj->data.net->mode);
+ }
+ OBJ(wireless_bitrate) {
+ snprintf(p, p_max_size, "%s", obj->data.net->bitrate);
+ }
+ OBJ(wireless_ap) {
+ snprintf(p, p_max_size, "%s", obj->data.net->ap);
+ }
+ OBJ(wireless_link_qual) {
+ snprintf(p, p_max_size, "%d", obj->data.net->link_qual);
+ }
+ OBJ(wireless_link_qual_max) {
+ snprintf(p, p_max_size, "%d", obj->data.net->link_qual_max);
+ }
+ OBJ(wireless_link_bar) {
+ new_bar(p, obj->a, obj->b, ((double)obj->data.net->link_qual/obj->data.net->link_qual_max)*255.0);
+ }
+#endif /* HAVE_IWLIB */
+
#endif /* __linux__ */
OBJ(freq_dyn) {
}
#endif /* __OpenBSD__ */
-#ifdef X11
OBJ(font) {
+#ifdef X11
new_font(p, obj->data.s);
- }
#endif /* X11 */
+ }
void format_diskio(unsigned int diskio_value)
{
if (!use_spacer) {
else show = obj->data.rss.act_par;
for(itmp = 0; itmp < show; itmp++) {
PRSS_Item *item = &data->items[itmp];
- if(i>0)
- strncat(p, "\n", p_max_size);
str = item->title;
- if(str[strlen(str)-1] == '\n')
- str[strlen(str)-1] = 0; // remove trailing new line if one exists
- strncat(p, item->title, p_max_size);
+ if(str) {
+ if(itmp>0) // don't add new line before first item
+ strncat(p, "\n", p_max_size);
+ if(str[strlen(str)-1] == '\n')
+ str[strlen(str)-1] = 0; // remove trailing new line if one exists, we have our own
+ strncat(p, str, p_max_size);
+ }
}
}
}
trans_speed /
1024));
else
- snprintf(p, 5, "%d ",
+ snprintf(p, 6, "%d ",
(int) (obj->data.net->
trans_speed /
1024));
#ifdef MPD
OBJ(mpd_title) {
- snprintf(p, p_max_size, "%s", cur->mpd.title);
+ snprintf(p, cur->mpd.max_title_len > 0 ?
+ cur->mpd.max_title_len : p_max_size, "%s",
+ cur->mpd.title);
}
OBJ(mpd_artist) {
snprintf(p, p_max_size, "%s", cur->mpd.artist);
if (obj->data.top.type == TOP_NAME
&& obj->data.top.num >= 0
&& obj->data.top.num < 10) {
- // if we limit the buffer and add a bunch of space after, it stops the thing from
- // moving other shit around, which is really fucking annoying
- snprintf(p, 17, "%s ", cur->cpu[obj->data.top.num]->name);
+ snprintf(p, 17, "%-17s", cur->cpu[obj->data.top.num]->name);
} else if (obj->data.top.type == TOP_CPU
&& obj->data.top.num >= 0
&& obj->data.top.num < 10) {
- snprintf(p, 7, "%3.2f ",
+ snprintf(p, 7, "%7.3f",
cur->cpu[obj->data.top.
num]->amount);
} else if (obj->data.top.type == TOP_PID
&& obj->data.top.num >= 0
&& obj->data.top.num < 10) {
- snprintf(p, 8, "%i ",
+ snprintf(p, 8, "%7i",
cur->cpu[obj->data.top.
num]->pid);
} else if (obj->data.top.type == TOP_MEM
&& obj->data.top.num >= 0
&& obj->data.top.num < 10) {
- snprintf(p, 7, "%3.2f ",
+ snprintf(p, 7, "%7.3f",
cur->cpu[obj->data.top.
num]->totalmem);
}
if (obj->data.top.type == TOP_NAME
&& obj->data.top.num >= 0
&& obj->data.top.num < 10) {
- // if we limit the buffer and add a bunch of space after, it stops the thing from
- // moving other shit around, which is really fucking annoying
- snprintf(p, 17,
- "%s ",
+ snprintf(p, 17, "%-17s",
cur->memu[obj->data.top.
num]->name);
} else if (obj->data.top.type == TOP_CPU
&& obj->data.top.num >= 0
&& obj->data.top.num < 10) {
- snprintf(p, 7, "%3.2f ",
+ snprintf(p, 7, "%7.3f",
cur->memu[obj->data.top.
num]->amount);
} else if (obj->data.top.type == TOP_PID
&& obj->data.top.num >= 0
&& obj->data.top.num < 10) {
- snprintf(p, 8, "%i ",
+ snprintf(p, 8, "%7i",
cur->memu[obj->data.top.
num]->pid);
} else if (obj->data.top.type == TOP_MEM
&& obj->data.top.num >= 0
&& obj->data.top.num < 10) {
- snprintf(p, 7, "%3.2f ",
+ snprintf(p, 7, "%7.3f",
cur->memu[obj->data.top.
num]->totalmem);
}
info.xmms2.status = NULL;
#endif
use_spacer = 0;
+#if defined(__linux__)
+ post_21_kernel = 0;
+#endif /* __linux__ */
#ifdef X11
out_to_console = 0;
#else
CONF("draw_outline") {
draw_outline = string_to_bool(value);
}
+#if defined(__linux__)
+ CONF("post_21_kernel") {
+ post_21_kernel = string_to_bool(value);
+ }
+#endif /* __linux__ */
#endif /* X11 */
CONF("out_to_console") {
out_to_console = string_to_bool(value);