Szymon Boniecki
Reads current LC_TIME
+Walt Nelson <wnelsonjr at comcast dot net>
+ $freq fix
+
William DiPlacido <bimbasaari at yahoo dot com>
Frequency from /proc/cpuinfo
Some other SETI stuff
+2005-07-24
+ * Conky now has UTF-8 support
+ * Fixed $freq for those with CPU scaling
+ * Fixed the problem with total_run_times
+ * Fixed alignment of bars and lines and stuff
+ * Reduced conky's memory usage (yay!)
+
2005-07-17
* Fixed a pile of bugs in configure script
* Added proper checking for headers in configure script
- * look into utf8 support
- * fix conky -i N stuff
- * fix bars not being centred
- * fix lines not being centred
- * fix bug where memory stuff gets messed when mpd_host is defined
- * fix bug with $freq
-
--- /dev/null
+#!/bin/sh
+
+aclocal-1.9
+autoheader-2.59
+automake-1.9 -a
+autoconf-2.59
fi
+
+
echo "$as_me:$LINENO: checking for getloadavg" >&5
echo $ECHO_N "checking for getloadavg... $ECHO_C" >&6
cat >conftest.$ac_ext <<_ACEOF
fi
fi
+AC_DEFUN([AM_LANGINFO_CODESET],
+[
+ AC_CACHE_CHECK([for nl_langinfo and CODESET], am_cv_langinfo_codeset,
+ [AC_TRY_LINK([#include <langinfo.h>],
+ [char* cs = nl_langinfo(CODESET);],
+ am_cv_langinfo_codeset=yes,
+ am_cv_langinfo_codeset=no)
+ ])
+ if test $am_cv_langinfo_codeset = yes; then
+ AC_DEFINE(HAVE_LANGINFO_CODESET, 1,
+ [Define if you have <langinfo.h> and nl_langinfo(CODESET).])
+ fi
+])
+
dnl
dnl Check getloadavg
dnl
static const char *scan_bar(const char *args, int *w, int *h)
{
*w = 0; /* zero width means all space that is available */
- *h = 4;
+ *h = 6;
/* bar's argument is either height or height,width */
if (args) {
int n = 0;
i2=0;
for(i2=0;i2<(8-(1+pos)%8) && added <= max;i2++)
{
- //printf("pos thinger %i added %i max %i\n",(8-(1+pos)%8), added, max);
- //printf("adding tab to: %s\n", s);
tmpstring2[pos+i2] = ' ';
added++;
}
pos += i2;
- //printf("not adding tab to: %s\n", s);
}
else
{
tmpstring2[pos] = tmpstring1[i];
pos++;
}
-/* else {
- tmpstring2[pos] = ' ';
- pos++;
- }*/
}
}
s = tmpstring2;
c2.color.green = c.green;
c2.color.blue = c.blue;
c2.color.alpha = font_alpha;
- //printf("at: %i, %i\nstring: %s", cur_x, cur_y, s);
- XftDrawString8(window.xftdraw, &c2, xftfont,
- cur_x, cur_y, (XftChar8 *) s, strlen(s));
+ XftDrawStringUtf8(window.xftdraw, &c2, xftfont,
+ cur_x, cur_y, (XftChar8 *) s, strlen(s));
} else
#endif
{
JoinMiter);
XDrawLine(display, window.drawable,
window.gc, cur_x,
- cur_y - mid, cur_x + w,
- cur_y - mid);
+ cur_y - mid/2, cur_x + w,
+ cur_y - mid/2);
}
break;
ss, 2);
XDrawLine(display, window.drawable,
window.gc, cur_x,
- cur_y - mid, cur_x + w,
- cur_y - mid);
+ cur_y - mid/2, cur_x + w,
+ cur_y - mid/2);
}
break;
specials[special_index].arg;
int by =
cur_y - (font_ascent() +
- h) / 2 + 1;
+ h) / 2 - 1;
w = specials[special_index].width;
if (w == 0)
w = text_start_x +
static void main_loop()
{
Region region = XCreateRegion();
- info.looped = 0;
- while (total_run_times == 0 || info.looped < total_run_times) {
+ info.looped = -1;
+ while (total_run_times == 0 || info.looped < total_run_times-1) {
info.looped++;
XFlush(display);
info.net_avg_samples = 2;
info.memmax = 0;
#ifdef MPD
- info.mpd.host = "localhost";
+ strcpy(info.mpd.host, "localhost");
info.mpd.port = 6600;
info.mpd.status = "Checking status...";
#endif
#ifdef MPD
CONF("mpd_host") {
if (value)
- info.
+ strcpy(info.
mpd.
host
- =
- value;
+ , value);
else
CONF_ERR}
CONF("mpd_port") {
int main(int argc, char **argv) {
/* handle command line parameters that don't change configs */
+ char *s;
+ int utf8_mode = 0;
+
+ if (((s = getenv("LC_ALL")) && *s) ||
+ ((s = getenv("LC_CTYPE")) && *s) ||
+ ((s = getenv("LANG")) && *s)) {
+ if (strstr(s, "UTF-8"))
+ utf8_mode = 1;
+ }
+ if (!setlocale(LC_CTYPE, "")) {
+ fprintf(stderr, "Can't set the specified locale! "
+ "Check LANG, LC_CTYPE, LC_ALL.\n");
+ return 1;
+ }
while
(1)
{
}
/* initalize X BEFORE we load config. (we need to so that 'screen' is set) */
init_X11
- ();
+ ();
tmpstring1 = (char*)malloc(2*TEXT_BUFFER_SIZE);
tmpstring2 = (char*)malloc(2*TEXT_BUFFER_SIZE);
#include <sys/utsname.h>
#include <stdio.h>
#include <stdlib.h>
+#include <locale.h>
+#include <langinfo.h>
+#include <wchar.h>
#if defined(HAVE_CAIRO_H) && defined(HAVE_CAIRO_XLIB_H) && defined(WANT_CAIRO)
#define CAIRO
#define TOP_PID 3
#define TOP_MEM 4
-#define TEXT_BUFFER_SIZE (1024*4)
+#define TEXT_BUFFER_SIZE 1024
#ifdef METAR
#include <metar.h>
char *status;
int volume;
unsigned int port;
- char *host;
+ char host[128];
float progress;
int bitrate;
};
return adt746x_cpu_state;
}
-static char *frequency;
+/* Thanks to "Walt Nelson" <wnelsonjr@comcast.net> */
+
+/***********************************************************************/
+/*
+ * $Id$
+ * This file is part of x86info.
+ * (C) 2001 Dave Jones.
+ *
+ * Licensed under the terms of the GNU GPL License version 2.
+ *
+ * Estimate CPU MHz routine by Andrea Arcangeli <andrea@suse.de>
+ * Small changes by David Sterba <sterd9am@ss1000.ms.mff.cuni.cz>
+ *
+ */
+
+__inline__ unsigned long long int rdtsc()
+{
+ unsigned long long int x;
+ __asm__ volatile (".byte 0x0f, 0x31" : "=A" (x));
+ return x;
+}
+
+static char *buffer = NULL;
char *get_freq()
{
- FILE *f;
- char s[1000];
- if (frequency == NULL) {
- frequency = (char *) malloc(100);
- assert(frequency != NULL);
- }
- //char frequency[10];
- f = fopen("/proc/cpuinfo", "r"); //open the CPU information file
- //if (!f)
- // return;
- while (fgets(s, 1000, f) != NULL) //read the file
- if (strncmp(s, "cpu M", 5) == 0) { //and search for the cpu mhz
- //printf("%s", strchr(s, ':')+2);
- strcpy(frequency, strchr(s, ':') + 2); //copy just the number
- frequency[strlen(frequency) - 1] = '\0'; // strip \n
- break;
- }
- fclose(f);
- return frequency;
+ if (buffer == NULL)
+ buffer = malloc(64);
+ struct timezone tz;
+ struct timeval tvstart, tvstop;
+ unsigned long long cycles[2]; /* gotta be 64 bit */
+ unsigned int microseconds; /* total time taken */
+
+ memset(&tz, 0, sizeof(tz));
+
+ /* get this function in cached memory */
+ gettimeofday(&tvstart, &tz);
+ cycles[0] = rdtsc();
+ gettimeofday(&tvstart, &tz);
+
+ /* we don't trust that this is any specific length of time */
+ usleep(100);
+
+ cycles[1] = rdtsc();
+ gettimeofday(&tvstop, &tz);
+ microseconds = ((tvstop.tv_sec-tvstart.tv_sec)*1000000) +
+ (tvstop.tv_usec-tvstart.tv_usec);
+
+ sprintf(buffer, "%lldMHz",
+ (cycles[1]-cycles[0])/microseconds);
+
+ return buffer;
}
+
#define ACPI_FAN_DIR "/proc/acpi/fan/"
static char *acpi_fan_state;