mirror of
https://github.com/Llewellynvdm/conky.git
synced 2025-01-24 07:38:27 +00:00
Merge branch 'master' into imlib2
This commit is contained in:
commit
d26b946b7b
@ -636,17 +636,25 @@ dnl
|
||||
dnl Check for OpenMP support
|
||||
dnl
|
||||
|
||||
AX_OPENMP([
|
||||
gcc_version=`$CC -dumpversion`
|
||||
gcc_major=`echo $gcc_version | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
|
||||
gcc_minor=`echo $gcc_version | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
|
||||
dnl check that the gcc version is >=4.3, if we're using gcc
|
||||
if test ! "x$GCC" = "xyes" -o $gcc_major -ge 4 -a $gcc_minor -ge 3; then
|
||||
AC_DEFINE(HAVE_OPENMP,1,[Define if OpenMP is enabled])
|
||||
CFLAGS="$CFLAGS $OPENMP_CFLAGS"
|
||||
fi
|
||||
AC_ARG_ENABLE([openmp],
|
||||
AC_HELP_STRING([--enable-openmp], [enable if you want OpenMP support @<:@default=no@:>@]),
|
||||
[want_openmp="$enableval"], [want_openmp=no])
|
||||
|
||||
])
|
||||
if test x$want_openmp = xyes; then
|
||||
AX_OPENMP([
|
||||
gcc_version=`$CC -dumpversion`
|
||||
gcc_major=`echo $gcc_version | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
|
||||
gcc_minor=`echo $gcc_version | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
|
||||
dnl check that the gcc version is >=4.3, if we're using gcc
|
||||
if test ! "x$GCC" = "xyes" -o $gcc_major -ge 4 -a $gcc_minor -ge 3; then
|
||||
AC_DEFINE(HAVE_OPENMP,1,[Define if OpenMP is enabled])
|
||||
CFLAGS="$CFLAGS $OPENMP_CFLAGS"
|
||||
else
|
||||
want_openmp=no
|
||||
fi
|
||||
|
||||
])
|
||||
fi
|
||||
|
||||
dnl
|
||||
dnl Check doc stuff
|
||||
@ -776,6 +784,7 @@ $PACKAGE $VERSION configured successfully:
|
||||
XMMS2: $want_xmms2
|
||||
|
||||
* General:
|
||||
OpenMP: $want_openmp
|
||||
math: $want_math
|
||||
hddtemp: $want_hddtemp
|
||||
portmon: $want_portmon
|
||||
|
53
data/conky_no_x11.conf
Normal file
53
data/conky_no_x11.conf
Normal file
@ -0,0 +1,53 @@
|
||||
# Conky, a system monitor, based on torsmo
|
||||
#
|
||||
# Any original torsmo code is licensed under the BSD license
|
||||
#
|
||||
# All code written since the fork of torsmo is licensed under the GPL
|
||||
#
|
||||
# Please see COPYING for details
|
||||
#
|
||||
# Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen
|
||||
# Copyright (c) 2005-2009 Brenden Matthews, Philip Kovacs, et. al. (see AUTHORS)
|
||||
# All rights reserved.
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
background no
|
||||
cpu_avg_samples 2
|
||||
net_avg_samples 2
|
||||
no_buffers yes
|
||||
out_to_console no
|
||||
out_to_stderr no
|
||||
update_interval 1.0
|
||||
uppercase no
|
||||
use_spacer none
|
||||
|
||||
TEXT
|
||||
${scroll 16 $nodename - $sysname $kernel on $machine | }
|
||||
Uptime: $uptime
|
||||
Frequency (in MHz): $freq
|
||||
Frequency (in GHz): $freq_g
|
||||
RAM Usage: $mem/$memmax - $memperc%
|
||||
Swap Usage: $swap/$swapmax - $swapperc%
|
||||
CPU Usage: $cpu%
|
||||
Processes: $processes Running: $running_processes
|
||||
File systems:
|
||||
/ ${fs_used /}/${fs_size /}
|
||||
Networking:
|
||||
Up: ${upspeed eth0} - Down: ${downspeed eth0}
|
||||
Name PID CPU% MEM%
|
||||
${top name 1} ${top pid 1} ${top cpu 1} ${top mem 1}
|
||||
${top name 2} ${top pid 2} ${top cpu 2} ${top mem 2}
|
||||
${top name 3} ${top pid 3} ${top cpu 3} ${top mem 3}
|
||||
${top name 4} ${top pid 4} ${top cpu 4} ${top mem 4}
|
@ -35,7 +35,11 @@ endif
|
||||
conky_DEPENDENCIES = $(config_output)
|
||||
BUILT_SOURCES = $(config_output)
|
||||
CLEANFILES = $(config_output)
|
||||
if BUILD_X11
|
||||
$(config_output): ../data/conky.conf
|
||||
else
|
||||
$(config_output): ../data/conky_no_x11.conf
|
||||
endif
|
||||
sh ../text2c.sh $< $@ defconfig
|
||||
endif
|
||||
|
||||
|
88
src/conky.c
88
src/conky.c
@ -722,9 +722,9 @@ static void free_text_objects(struct text_object *root)
|
||||
case OBJ_image:
|
||||
case OBJ_eval:
|
||||
case OBJ_exec:
|
||||
case OBJ_execbar:
|
||||
#ifdef X11
|
||||
case OBJ_execgauge:
|
||||
case OBJ_execbar:
|
||||
case OBJ_execgraph:
|
||||
#endif
|
||||
case OBJ_execp:
|
||||
@ -1475,13 +1475,13 @@ static struct text_object *construct_text_object(const char *s,
|
||||
obj->a = default_##arg##_width; \
|
||||
obj->b = default_##arg##_height; \
|
||||
}
|
||||
END OBJ(execbar, 0)
|
||||
SIZE_DEFAULTS(bar);
|
||||
obj->data.s = strndup(arg ? arg : "", text_buffer_size);
|
||||
#ifdef X11
|
||||
END OBJ(execgauge, 0)
|
||||
SIZE_DEFAULTS(gauge);
|
||||
obj->data.s = strndup(arg ? arg : "", text_buffer_size);
|
||||
END OBJ(execbar, 0)
|
||||
SIZE_DEFAULTS(bar);
|
||||
obj->data.s = strndup(arg ? arg : "", text_buffer_size);
|
||||
END OBJ(execgraph, 0)
|
||||
SIZE_DEFAULTS(graph);
|
||||
obj->data.s = strndup(arg ? arg : "", text_buffer_size);
|
||||
@ -2900,28 +2900,41 @@ static int text_contains_templates(const char *text)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void remove_comments(char *string)
|
||||
static void strfold(char *start, int count)
|
||||
{
|
||||
char *curplace;
|
||||
for (curplace = start + count; *curplace != 0; curplace++) {
|
||||
*(curplace - count) = *curplace;
|
||||
}
|
||||
*(curplace - count - 1) = 0;
|
||||
}
|
||||
|
||||
static size_t remove_comments(char *string)
|
||||
{
|
||||
char *curplace, *curplace2;
|
||||
char *newend = NULL;
|
||||
|
||||
for(curplace = string; *curplace != 0; curplace++) {
|
||||
if(*curplace == '\\' && *(curplace + 1) == '#') {
|
||||
//strcpy can't be used for overlapping strings
|
||||
for (curplace2 = curplace+1; *curplace2 != 0; curplace2++) {
|
||||
*(curplace2 - 1) = *curplace2;
|
||||
size_t folded = 0;
|
||||
for (curplace = string; *curplace != 0; curplace++) {
|
||||
if (*curplace == '\\' && *(curplace + 1) == '#') {
|
||||
// strcpy can't be used for overlapping strings
|
||||
strfold(curplace, 1);
|
||||
folded += 1;
|
||||
} else if (*curplace == '#') {
|
||||
// remove everything until we hit a '\n'
|
||||
curplace2 = curplace;
|
||||
while (*curplace2) {
|
||||
curplace2++;
|
||||
if (*curplace2 == '\n' &&
|
||||
*(curplace2 + 1) != '#') break;
|
||||
}
|
||||
if (*curplace2) {
|
||||
strfold(curplace, curplace2 - curplace);
|
||||
folded += curplace2 - curplace;
|
||||
} else {
|
||||
*curplace = 0;
|
||||
}
|
||||
*(curplace2 - 1) = 0;
|
||||
} else if(*curplace == '#' && !newend) {
|
||||
newend = curplace;
|
||||
} else if(*curplace == '\n' && newend) {
|
||||
*newend = '\n';
|
||||
newend++;
|
||||
}
|
||||
}
|
||||
if(newend) {
|
||||
*newend = 0;
|
||||
}
|
||||
return folded;
|
||||
}
|
||||
|
||||
static int extract_variable_text_internal(struct text_object *retval, const char *const_p, char allow_threaded)
|
||||
@ -2932,6 +2945,7 @@ static int extract_variable_text_internal(struct text_object *retval, const char
|
||||
void *ifblock_opaque = NULL;
|
||||
char *tmp_p;
|
||||
char *arg = 0;
|
||||
size_t len = 0;
|
||||
|
||||
p = strndup(const_p, max_user_text - 1);
|
||||
while (text_contains_templates(p)) {
|
||||
@ -2969,7 +2983,6 @@ static int extract_variable_text_internal(struct text_object *retval, const char
|
||||
if (*p != '$') {
|
||||
char buf[256];
|
||||
const char *var;
|
||||
unsigned int len;
|
||||
|
||||
/* variable is either $foo or ${foo} */
|
||||
if (*p == '{') {
|
||||
@ -3056,10 +3069,13 @@ static int extract_variable_text_internal(struct text_object *retval, const char
|
||||
append_object(retval, obj);
|
||||
}
|
||||
}
|
||||
} else if (*p == '#') {
|
||||
remove_comments(p);
|
||||
}
|
||||
p++;
|
||||
}
|
||||
remove_comments(s);
|
||||
printf("'%s'\n", s);
|
||||
obj = create_plain_text(s);
|
||||
if (obj != NULL) {
|
||||
append_object(retval, obj);
|
||||
@ -3263,7 +3279,8 @@ static void generate_text_internal(char *p, int p_max_size,
|
||||
#endif
|
||||
|
||||
p[0] = 0;
|
||||
for (obj = root.next; obj && p_max_size > 0; obj = obj->next) {
|
||||
obj = root.next;
|
||||
while (obj && p_max_size > 0) {
|
||||
needed = 0; // reset for top stuff
|
||||
|
||||
/* IFBLOCK jumping algorithm
|
||||
@ -3755,17 +3772,33 @@ static void generate_text_internal(char *p, int p_max_size,
|
||||
new_gauge(p, obj->a, obj->b, round_to_int(barnum * 255.0));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
OBJ(execbar) {
|
||||
double barnum;
|
||||
#ifndef X11
|
||||
int i;
|
||||
#endif
|
||||
|
||||
read_exec(obj->data.s, p, text_buffer_size);
|
||||
barnum = get_barnum(p);
|
||||
|
||||
if (barnum >= 0.0) {
|
||||
#ifdef X11
|
||||
barnum /= 100;
|
||||
new_bar(p, obj->a, obj->b, round_to_int(barnum * 255.0));
|
||||
#else
|
||||
barnum = round_to_int( ( barnum * obj->a ) / 100);
|
||||
for(i=0; i<barnum; i++) {
|
||||
*(p+i)='#';
|
||||
}
|
||||
for(; i < obj->a; i++) {
|
||||
*(p+i)='_';
|
||||
}
|
||||
*(p+i)=0;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#ifdef X11
|
||||
OBJ(execgraph) {
|
||||
char showaslog = FALSE;
|
||||
double barnum;
|
||||
@ -5240,6 +5273,7 @@ static void generate_text_internal(char *p, int p_max_size,
|
||||
p += a;
|
||||
p_max_size -= a;
|
||||
}
|
||||
obj = obj->next;
|
||||
}
|
||||
}
|
||||
|
||||
@ -7087,7 +7121,6 @@ static void load_config_file(const char *f)
|
||||
CONF_ERR;
|
||||
}
|
||||
}
|
||||
#ifdef X11
|
||||
CONF("default_bar_size") {
|
||||
char err = 0;
|
||||
if (value) {
|
||||
@ -7101,6 +7134,7 @@ static void load_config_file(const char *f)
|
||||
CONF_ERR2("default_bar_size takes 2 integer arguments (ie. 'default_bar_size 0 6')")
|
||||
}
|
||||
}
|
||||
#ifdef X11
|
||||
CONF("default_graph_size") {
|
||||
char err = 0;
|
||||
if (value) {
|
||||
@ -7532,6 +7566,12 @@ static void load_config_file(const char *f)
|
||||
}
|
||||
}
|
||||
CONF("text") {
|
||||
#ifdef X11
|
||||
if(output_methods & TO_X) {
|
||||
X11_initialisation();
|
||||
}
|
||||
#endif
|
||||
|
||||
if (global_text) {
|
||||
free(global_text);
|
||||
global_text = 0;
|
||||
|
@ -46,11 +46,15 @@ unsigned int special_count;
|
||||
int default_bar_width = 0, default_bar_height = 6;
|
||||
int default_graph_width = 0, default_graph_height = 25;
|
||||
int default_gauge_width = 50, default_gauge_height = 25;
|
||||
#else
|
||||
int default_bar_width = 10, default_bar_height = 1;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Scanning arguments to various special text objects
|
||||
*/
|
||||
|
||||
#ifdef X11
|
||||
const char *scan_gauge(const char *args, int *w, int *h)
|
||||
{
|
||||
/*width and height*/
|
||||
|
@ -76,9 +76,9 @@ struct special_t {
|
||||
extern struct special_t *specials;
|
||||
extern unsigned int special_count;
|
||||
|
||||
#ifdef X11
|
||||
extern int default_bar_width;
|
||||
extern int default_bar_height;
|
||||
#ifdef X11
|
||||
extern int default_graph_width;
|
||||
extern int default_graph_height;
|
||||
extern int default_gauge_width;
|
||||
|
@ -104,9 +104,9 @@ enum text_object_type {
|
||||
OBJ_exec,
|
||||
OBJ_execi,
|
||||
OBJ_texeci,
|
||||
OBJ_execbar,
|
||||
#ifdef X11
|
||||
OBJ_execgauge,
|
||||
OBJ_execbar,
|
||||
OBJ_execgraph,
|
||||
OBJ_execibar,
|
||||
OBJ_execigraph,
|
||||
|
Loading…
x
Reference in New Issue
Block a user