mirror of
https://github.com/Llewellynvdm/conky.git
synced 2025-02-03 12:38:38 +00:00
Merge branch 'master' into imlib2
This commit is contained in:
commit
d26b946b7b
@ -636,7 +636,12 @@ dnl
|
|||||||
dnl Check for OpenMP support
|
dnl Check for OpenMP support
|
||||||
dnl
|
dnl
|
||||||
|
|
||||||
AX_OPENMP([
|
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_version=`$CC -dumpversion`
|
||||||
gcc_major=`echo $gcc_version | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
|
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/'`
|
gcc_minor=`echo $gcc_version | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
|
||||||
@ -644,9 +649,12 @@ AX_OPENMP([
|
|||||||
if test ! "x$GCC" = "xyes" -o $gcc_major -ge 4 -a $gcc_minor -ge 3; then
|
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])
|
AC_DEFINE(HAVE_OPENMP,1,[Define if OpenMP is enabled])
|
||||||
CFLAGS="$CFLAGS $OPENMP_CFLAGS"
|
CFLAGS="$CFLAGS $OPENMP_CFLAGS"
|
||||||
|
else
|
||||||
|
want_openmp=no
|
||||||
fi
|
fi
|
||||||
|
|
||||||
])
|
])
|
||||||
|
fi
|
||||||
|
|
||||||
dnl
|
dnl
|
||||||
dnl Check doc stuff
|
dnl Check doc stuff
|
||||||
@ -776,6 +784,7 @@ $PACKAGE $VERSION configured successfully:
|
|||||||
XMMS2: $want_xmms2
|
XMMS2: $want_xmms2
|
||||||
|
|
||||||
* General:
|
* General:
|
||||||
|
OpenMP: $want_openmp
|
||||||
math: $want_math
|
math: $want_math
|
||||||
hddtemp: $want_hddtemp
|
hddtemp: $want_hddtemp
|
||||||
portmon: $want_portmon
|
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)
|
conky_DEPENDENCIES = $(config_output)
|
||||||
BUILT_SOURCES = $(config_output)
|
BUILT_SOURCES = $(config_output)
|
||||||
CLEANFILES = $(config_output)
|
CLEANFILES = $(config_output)
|
||||||
|
if BUILD_X11
|
||||||
$(config_output): ../data/conky.conf
|
$(config_output): ../data/conky.conf
|
||||||
|
else
|
||||||
|
$(config_output): ../data/conky_no_x11.conf
|
||||||
|
endif
|
||||||
sh ../text2c.sh $< $@ defconfig
|
sh ../text2c.sh $< $@ defconfig
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
86
src/conky.c
86
src/conky.c
@ -722,9 +722,9 @@ static void free_text_objects(struct text_object *root)
|
|||||||
case OBJ_image:
|
case OBJ_image:
|
||||||
case OBJ_eval:
|
case OBJ_eval:
|
||||||
case OBJ_exec:
|
case OBJ_exec:
|
||||||
|
case OBJ_execbar:
|
||||||
#ifdef X11
|
#ifdef X11
|
||||||
case OBJ_execgauge:
|
case OBJ_execgauge:
|
||||||
case OBJ_execbar:
|
|
||||||
case OBJ_execgraph:
|
case OBJ_execgraph:
|
||||||
#endif
|
#endif
|
||||||
case OBJ_execp:
|
case OBJ_execp:
|
||||||
@ -1475,13 +1475,13 @@ static struct text_object *construct_text_object(const char *s,
|
|||||||
obj->a = default_##arg##_width; \
|
obj->a = default_##arg##_width; \
|
||||||
obj->b = default_##arg##_height; \
|
obj->b = default_##arg##_height; \
|
||||||
}
|
}
|
||||||
|
END OBJ(execbar, 0)
|
||||||
|
SIZE_DEFAULTS(bar);
|
||||||
|
obj->data.s = strndup(arg ? arg : "", text_buffer_size);
|
||||||
#ifdef X11
|
#ifdef X11
|
||||||
END OBJ(execgauge, 0)
|
END OBJ(execgauge, 0)
|
||||||
SIZE_DEFAULTS(gauge);
|
SIZE_DEFAULTS(gauge);
|
||||||
obj->data.s = strndup(arg ? arg : "", text_buffer_size);
|
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)
|
END OBJ(execgraph, 0)
|
||||||
SIZE_DEFAULTS(graph);
|
SIZE_DEFAULTS(graph);
|
||||||
obj->data.s = strndup(arg ? arg : "", text_buffer_size);
|
obj->data.s = strndup(arg ? arg : "", text_buffer_size);
|
||||||
@ -2900,28 +2900,41 @@ static int text_contains_templates(const char *text)
|
|||||||
return 0;
|
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 *curplace, *curplace2;
|
||||||
char *newend = NULL;
|
size_t folded = 0;
|
||||||
|
for (curplace = string; *curplace != 0; curplace++) {
|
||||||
for(curplace = string; *curplace != 0; curplace++) {
|
if (*curplace == '\\' && *(curplace + 1) == '#') {
|
||||||
if(*curplace == '\\' && *(curplace + 1) == '#') {
|
// strcpy can't be used for overlapping strings
|
||||||
//strcpy can't be used for overlapping strings
|
strfold(curplace, 1);
|
||||||
for (curplace2 = curplace+1; *curplace2 != 0; curplace2++) {
|
folded += 1;
|
||||||
*(curplace2 - 1) = *curplace2;
|
} else if (*curplace == '#') {
|
||||||
|
// remove everything until we hit a '\n'
|
||||||
|
curplace2 = curplace;
|
||||||
|
while (*curplace2) {
|
||||||
|
curplace2++;
|
||||||
|
if (*curplace2 == '\n' &&
|
||||||
|
*(curplace2 + 1) != '#') break;
|
||||||
}
|
}
|
||||||
*(curplace2 - 1) = 0;
|
if (*curplace2) {
|
||||||
} else if(*curplace == '#' && !newend) {
|
strfold(curplace, curplace2 - curplace);
|
||||||
newend = curplace;
|
folded += curplace2 - curplace;
|
||||||
} else if(*curplace == '\n' && newend) {
|
} else {
|
||||||
*newend = '\n';
|
*curplace = 0;
|
||||||
newend++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(newend) {
|
|
||||||
*newend = 0;
|
|
||||||
}
|
}
|
||||||
|
return folded;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int extract_variable_text_internal(struct text_object *retval, const char *const_p, char allow_threaded)
|
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;
|
void *ifblock_opaque = NULL;
|
||||||
char *tmp_p;
|
char *tmp_p;
|
||||||
char *arg = 0;
|
char *arg = 0;
|
||||||
|
size_t len = 0;
|
||||||
|
|
||||||
p = strndup(const_p, max_user_text - 1);
|
p = strndup(const_p, max_user_text - 1);
|
||||||
while (text_contains_templates(p)) {
|
while (text_contains_templates(p)) {
|
||||||
@ -2969,7 +2983,6 @@ static int extract_variable_text_internal(struct text_object *retval, const char
|
|||||||
if (*p != '$') {
|
if (*p != '$') {
|
||||||
char buf[256];
|
char buf[256];
|
||||||
const char *var;
|
const char *var;
|
||||||
unsigned int len;
|
|
||||||
|
|
||||||
/* variable is either $foo or ${foo} */
|
/* variable is either $foo or ${foo} */
|
||||||
if (*p == '{') {
|
if (*p == '{') {
|
||||||
@ -3056,10 +3069,13 @@ static int extract_variable_text_internal(struct text_object *retval, const char
|
|||||||
append_object(retval, obj);
|
append_object(retval, obj);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else if (*p == '#') {
|
||||||
|
remove_comments(p);
|
||||||
}
|
}
|
||||||
p++;
|
p++;
|
||||||
}
|
}
|
||||||
remove_comments(s);
|
remove_comments(s);
|
||||||
|
printf("'%s'\n", s);
|
||||||
obj = create_plain_text(s);
|
obj = create_plain_text(s);
|
||||||
if (obj != NULL) {
|
if (obj != NULL) {
|
||||||
append_object(retval, obj);
|
append_object(retval, obj);
|
||||||
@ -3263,7 +3279,8 @@ static void generate_text_internal(char *p, int p_max_size,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
p[0] = 0;
|
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
|
needed = 0; // reset for top stuff
|
||||||
|
|
||||||
/* IFBLOCK jumping algorithm
|
/* 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));
|
new_gauge(p, obj->a, obj->b, round_to_int(barnum * 255.0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
OBJ(execbar) {
|
OBJ(execbar) {
|
||||||
double barnum;
|
double barnum;
|
||||||
|
#ifndef X11
|
||||||
|
int i;
|
||||||
|
#endif
|
||||||
|
|
||||||
read_exec(obj->data.s, p, text_buffer_size);
|
read_exec(obj->data.s, p, text_buffer_size);
|
||||||
barnum = get_barnum(p);
|
barnum = get_barnum(p);
|
||||||
|
|
||||||
if (barnum >= 0.0) {
|
if (barnum >= 0.0) {
|
||||||
|
#ifdef X11
|
||||||
barnum /= 100;
|
barnum /= 100;
|
||||||
new_bar(p, obj->a, obj->b, round_to_int(barnum * 255.0));
|
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) {
|
OBJ(execgraph) {
|
||||||
char showaslog = FALSE;
|
char showaslog = FALSE;
|
||||||
double barnum;
|
double barnum;
|
||||||
@ -5240,6 +5273,7 @@ static void generate_text_internal(char *p, int p_max_size,
|
|||||||
p += a;
|
p += a;
|
||||||
p_max_size -= a;
|
p_max_size -= a;
|
||||||
}
|
}
|
||||||
|
obj = obj->next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -7087,7 +7121,6 @@ static void load_config_file(const char *f)
|
|||||||
CONF_ERR;
|
CONF_ERR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef X11
|
|
||||||
CONF("default_bar_size") {
|
CONF("default_bar_size") {
|
||||||
char err = 0;
|
char err = 0;
|
||||||
if (value) {
|
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')")
|
CONF_ERR2("default_bar_size takes 2 integer arguments (ie. 'default_bar_size 0 6')")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#ifdef X11
|
||||||
CONF("default_graph_size") {
|
CONF("default_graph_size") {
|
||||||
char err = 0;
|
char err = 0;
|
||||||
if (value) {
|
if (value) {
|
||||||
@ -7532,6 +7566,12 @@ static void load_config_file(const char *f)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
CONF("text") {
|
CONF("text") {
|
||||||
|
#ifdef X11
|
||||||
|
if(output_methods & TO_X) {
|
||||||
|
X11_initialisation();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (global_text) {
|
if (global_text) {
|
||||||
free(global_text);
|
free(global_text);
|
||||||
global_text = 0;
|
global_text = 0;
|
||||||
|
@ -46,11 +46,15 @@ unsigned int special_count;
|
|||||||
int default_bar_width = 0, default_bar_height = 6;
|
int default_bar_width = 0, default_bar_height = 6;
|
||||||
int default_graph_width = 0, default_graph_height = 25;
|
int default_graph_width = 0, default_graph_height = 25;
|
||||||
int default_gauge_width = 50, default_gauge_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
|
* Scanning arguments to various special text objects
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef X11
|
||||||
const char *scan_gauge(const char *args, int *w, int *h)
|
const char *scan_gauge(const char *args, int *w, int *h)
|
||||||
{
|
{
|
||||||
/*width and height*/
|
/*width and height*/
|
||||||
|
@ -76,9 +76,9 @@ struct special_t {
|
|||||||
extern struct special_t *specials;
|
extern struct special_t *specials;
|
||||||
extern unsigned int special_count;
|
extern unsigned int special_count;
|
||||||
|
|
||||||
#ifdef X11
|
|
||||||
extern int default_bar_width;
|
extern int default_bar_width;
|
||||||
extern int default_bar_height;
|
extern int default_bar_height;
|
||||||
|
#ifdef X11
|
||||||
extern int default_graph_width;
|
extern int default_graph_width;
|
||||||
extern int default_graph_height;
|
extern int default_graph_height;
|
||||||
extern int default_gauge_width;
|
extern int default_gauge_width;
|
||||||
|
@ -104,9 +104,9 @@ enum text_object_type {
|
|||||||
OBJ_exec,
|
OBJ_exec,
|
||||||
OBJ_execi,
|
OBJ_execi,
|
||||||
OBJ_texeci,
|
OBJ_texeci,
|
||||||
|
OBJ_execbar,
|
||||||
#ifdef X11
|
#ifdef X11
|
||||||
OBJ_execgauge,
|
OBJ_execgauge,
|
||||||
OBJ_execbar,
|
|
||||||
OBJ_execgraph,
|
OBJ_execgraph,
|
||||||
OBJ_execibar,
|
OBJ_execibar,
|
||||||
OBJ_execigraph,
|
OBJ_execigraph,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user