Externalize default config file: /conky/conky.conf
git-svn-id: https://conky.svn.sourceforge.net/svnroot/conky/trunk/conky1@981 7f574dfc-610e-0410-a909-a81674777703
This commit is contained in:
@@ -1,5 +1,8 @@
|
|||||||
# $Id$
|
# $Id$
|
||||||
|
|
||||||
|
2008-10-23
|
||||||
|
* Externalize default config file: ${sysconfdir}/conky/conky.conf
|
||||||
|
|
||||||
2008-10-21
|
2008-10-21
|
||||||
* Initialize music_player_interval so built-in .conkyrc actual works.
|
* Initialize music_player_interval so built-in .conkyrc actual works.
|
||||||
* Lower timed_thread minimum timing interval from 50 usecs to 10 usecs.
|
* Lower timed_thread minimum timing interval from 50 usecs to 10 usecs.
|
||||||
|
29
Makefile.am
29
Makefile.am
@@ -1,6 +1,33 @@
|
|||||||
|
# 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-2007 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/>.
|
||||||
|
#
|
||||||
|
# $Id$
|
||||||
|
|
||||||
SUBDIRS = \
|
SUBDIRS = \
|
||||||
src \
|
src \
|
||||||
doc
|
doc \
|
||||||
|
data
|
||||||
|
|
||||||
AUTOMAKE_OPTIONS = \
|
AUTOMAKE_OPTIONS = \
|
||||||
1.8 \
|
1.8 \
|
||||||
|
27
autogen.sh
27
autogen.sh
@@ -1,7 +1,30 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# 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-2007 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/>.
|
||||||
|
#
|
||||||
# $Id$
|
# $Id$
|
||||||
|
|
||||||
# autogen.sh
|
|
||||||
#
|
#
|
||||||
# optional $1 = optional directory containing build tree or svn working copy
|
# optional $1 = optional directory containing build tree or svn working copy
|
||||||
|
|
||||||
|
@@ -39,6 +39,7 @@ PKG_PROG_PKG_CONFIG([0.19])
|
|||||||
|
|
||||||
AC_CONFIG_FILES(
|
AC_CONFIG_FILES(
|
||||||
Makefile
|
Makefile
|
||||||
|
data/Makefile
|
||||||
doc/Makefile
|
doc/Makefile
|
||||||
src/Makefile
|
src/Makefile
|
||||||
src/build.h
|
src/build.h
|
||||||
@@ -543,6 +544,7 @@ cat << EOF
|
|||||||
$PACKAGE $VERSION configured successfully:
|
$PACKAGE $VERSION configured successfully:
|
||||||
|
|
||||||
Installing into: $prefix
|
Installing into: $prefix
|
||||||
|
System config dir: $sysconfdir
|
||||||
C compiler flags: $CFLAGS
|
C compiler flags: $CFLAGS
|
||||||
Linker flags: $LDFLAGS
|
Linker flags: $LDFLAGS
|
||||||
Libraries: $LIBS
|
Libraries: $LIBS
|
||||||
|
30
data/Makefile.am
Normal file
30
data/Makefile.am
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
# 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-2007 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/>.
|
||||||
|
#
|
||||||
|
# $Id$
|
||||||
|
|
||||||
|
configdir = ${sysconfdir}/conky
|
||||||
|
dist_config_DATA = conky.conf
|
||||||
|
|
||||||
|
# vi:set ts=8 sw=8 noet ai nocindent syntax=automake:
|
48
data/conky.conf
Normal file
48
data/conky.conf
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
alignment bottom_left
|
||||||
|
background no
|
||||||
|
border_width 1
|
||||||
|
cpu_avg_samples 2
|
||||||
|
default_color white
|
||||||
|
default_outline_color white
|
||||||
|
default_shade_color white
|
||||||
|
draw_borders no
|
||||||
|
draw_graph_borders yes
|
||||||
|
draw_outline no
|
||||||
|
draw_shades no
|
||||||
|
font 6x10
|
||||||
|
gap_x 5
|
||||||
|
gap_y 60
|
||||||
|
minimum_size 5 5
|
||||||
|
net_avg_samples 2
|
||||||
|
no_buffers yes
|
||||||
|
out_to_console no
|
||||||
|
own_window yes
|
||||||
|
own_window_class Conky
|
||||||
|
own_window_type normal
|
||||||
|
stippled_borders 0
|
||||||
|
update_interval 3.0
|
||||||
|
uppercase no
|
||||||
|
use_spacer no
|
||||||
|
|
||||||
|
TEXT
|
||||||
|
$nodename - $sysname $kernel on $machine
|
||||||
|
$hr
|
||||||
|
${color grey}Uptime:$color $uptime
|
||||||
|
${color grey}Frequency (in MHz):$color $freq
|
||||||
|
${color grey}Frequency (in GHz):$color $freq_g
|
||||||
|
${color grey}RAM Usage:$color $mem/$memmax - $memperc% ${membar 4}
|
||||||
|
${color grey}Swap Usage:$color $swap/$swapmax - $swapperc% ${swapbar 4}
|
||||||
|
${color grey}CPU Usage:$color $cpu% ${cpubar 4}
|
||||||
|
${color grey}Processes:$color $processes ${color grey}Running:$color $running_processes
|
||||||
|
$hr
|
||||||
|
${color grey}File systems:
|
||||||
|
/ $color${fs_free /}/${fs_size /} ${fs_bar 6 /}
|
||||||
|
${color grey}Networking:
|
||||||
|
Up:$color ${upspeed eth0} k/s${color grey} - Down:$color ${downspeed eth0} k/s
|
||||||
|
$hr
|
||||||
|
${color grey}Name PID CPU% MEM%
|
||||||
|
${color lightgrey} ${top name 1} ${top pid 1} ${top cpu 1} ${top mem 1}
|
||||||
|
${color lightgrey} ${top name 2} ${top pid 2} ${top cpu 2} ${top mem 2}
|
||||||
|
${color lightgrey} ${top name 3} ${top pid 3} ${top cpu 3} ${top mem 3}
|
||||||
|
${color lightgrey} ${top name 4} ${top pid 4} ${top cpu 4} ${top mem 4}
|
||||||
|
|
@@ -1,3 +1,32 @@
|
|||||||
|
# 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-2007 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/>.
|
||||||
|
#
|
||||||
|
# $Id$
|
||||||
|
|
||||||
|
INCLUDES = \
|
||||||
|
-DSYSTEM_CONFIG_FILE=\"$(sysconfdir)/conky/conky.conf\"
|
||||||
|
|
||||||
bin_PROGRAMS = conky
|
bin_PROGRAMS = conky
|
||||||
|
|
||||||
if BUILD_AUDACIOUS
|
if BUILD_AUDACIOUS
|
||||||
|
83
src/conky.c
83
src/conky.c
@@ -411,39 +411,7 @@ static int pad_percents = 0;
|
|||||||
tcp_port_monitor_args_t tcp_port_monitor_args;
|
tcp_port_monitor_args_t tcp_port_monitor_args;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Text that is shown */
|
static char *text = 0;
|
||||||
static char original_text[] =
|
|
||||||
"$nodename - $sysname $kernel on $machine\n"
|
|
||||||
"$hr\n"
|
|
||||||
"${color grey}Uptime:$color $uptime\n"
|
|
||||||
"${color grey}Frequency (in MHz):$color $freq\n"
|
|
||||||
"${color grey}Frequency (in GHz):$color $freq_g\n"
|
|
||||||
"${color grey}RAM Usage:$color $mem/$memmax - $memperc% ${membar 4}\n"
|
|
||||||
"${color grey}Swap Usage:$color $swap/$swapmax - $swapperc% ${swapbar 4}\n"
|
|
||||||
"${color grey}CPU Usage:$color $cpu% ${cpubar 4}\n"
|
|
||||||
"${color grey}Processes:$color $processes ${color grey}Running:$color $running_processes\n"
|
|
||||||
"$hr\n"
|
|
||||||
"${color grey}File systems:\n"
|
|
||||||
" / $color${fs_free /}/${fs_size /} ${fs_bar 6 /}\n"
|
|
||||||
"${color grey}Networking:\n"
|
|
||||||
" Up:$color ${upspeed eth0} k/s${color grey} - Down:$color ${downspeed eth0} k/s\n"
|
|
||||||
"$hr\n"
|
|
||||||
#ifdef MPD
|
|
||||||
"${color grey}MPD: $mpd_status $mpd_artist - $mpd_title from $mpd_album at $mpd_vol\n"
|
|
||||||
"Bitrate: $mpd_bitrate\n" "Progress: $mpd_bar\n"
|
|
||||||
#endif
|
|
||||||
#ifdef XMMS2
|
|
||||||
"${color grey}XMMS2: $xmms2_status $xmms2_artist - $xmms2_title from $xmms2_album\n"
|
|
||||||
"Progress: $xmms2_bar\n"
|
|
||||||
#endif
|
|
||||||
"${color grey}Name PID CPU% MEM%\n"
|
|
||||||
" ${color lightgrey} ${top name 1} ${top pid 1} ${top cpu 1} ${top mem 1}\n"
|
|
||||||
" ${color lightgrey} ${top name 2} ${top pid 2} ${top cpu 2} ${top mem 2}\n"
|
|
||||||
" ${color lightgrey} ${top name 3} ${top pid 3} ${top cpu 3} ${top mem 3}\n"
|
|
||||||
" ${color lightgrey} ${top name 4} ${top pid 4} ${top cpu 4} ${top mem 4}\n"
|
|
||||||
;
|
|
||||||
|
|
||||||
static char *text = original_text;
|
|
||||||
long text_lines;
|
long text_lines;
|
||||||
|
|
||||||
static int total_updates;
|
static int total_updates;
|
||||||
@@ -6897,7 +6865,7 @@ void clean_up(void)
|
|||||||
text_object_count = 0;
|
text_object_count = 0;
|
||||||
text_objects = NULL;
|
text_objects = NULL;
|
||||||
|
|
||||||
if (text != original_text)
|
if (!text)
|
||||||
free(text);
|
free(text);
|
||||||
|
|
||||||
free(current_config);
|
free(current_config);
|
||||||
@@ -7016,7 +6984,7 @@ static void set_default_configurations(void)
|
|||||||
draw_outline = 0;
|
draw_outline = 0;
|
||||||
set_first_font("6x10");
|
set_first_font("6x10");
|
||||||
gap_x = 5;
|
gap_x = 5;
|
||||||
gap_y = 5;
|
gap_y = 60;
|
||||||
minimum_width = 5;
|
minimum_width = 5;
|
||||||
minimum_height = 5;
|
minimum_height = 5;
|
||||||
maximum_width = 0;
|
maximum_width = 0;
|
||||||
@@ -7026,7 +6994,7 @@ static void set_default_configurations(void)
|
|||||||
window.hints=0;
|
window.hints=0;
|
||||||
strcpy(window.class_name, "Conky");
|
strcpy(window.class_name, "Conky");
|
||||||
update_uname();
|
update_uname();
|
||||||
sprintf(window.title,"%s - conky",info.uname_s.nodename);
|
sprintf(window.title,"Conky (%s)",info.uname_s.nodename);
|
||||||
#endif
|
#endif
|
||||||
stippled_borders = 0;
|
stippled_borders = 0;
|
||||||
border_margin = 3;
|
border_margin = 3;
|
||||||
@@ -7568,7 +7536,7 @@ else if (strcasecmp(name, a) == 0 || strcasecmp(name, b) == 0)
|
|||||||
CONF_ERR;
|
CONF_ERR;
|
||||||
}
|
}
|
||||||
CONF("text") {
|
CONF("text") {
|
||||||
if (text != original_text)
|
if (!text)
|
||||||
free(text);
|
free(text);
|
||||||
|
|
||||||
text = (char *)
|
text = (char *)
|
||||||
@@ -7694,8 +7662,6 @@ int main(int argc, char **argv)
|
|||||||
case 'V':
|
case 'V':
|
||||||
print_version();
|
print_version();
|
||||||
case 'c':
|
case 'c':
|
||||||
/* if current_config is set to a strdup of CONFIG_FILE, free it (even
|
|
||||||
* though free() does the NULL check itself;), then load optarg value */
|
|
||||||
if (current_config)
|
if (current_config)
|
||||||
free(current_config);
|
free(current_config);
|
||||||
current_config = strdup(optarg);
|
current_config = strdup(optarg);
|
||||||
@@ -7708,9 +7674,7 @@ int main(int argc, char **argv)
|
|||||||
"window. Command line options will override configurations defined in config\n"
|
"window. Command line options will override configurations defined in config\n"
|
||||||
"file.\n"
|
"file.\n"
|
||||||
" -V version\n"
|
" -V version\n"
|
||||||
" -c FILE config file to load instead of "
|
" -c FILE config file to load\n"
|
||||||
CONFIG_FILE
|
|
||||||
"\n"
|
|
||||||
" -d daemonize, fork to background\n"
|
" -d daemonize, fork to background\n"
|
||||||
" -h help\n"
|
" -h help\n"
|
||||||
#ifdef X11
|
#ifdef X11
|
||||||
@@ -7745,25 +7709,32 @@ int main(int argc, char **argv)
|
|||||||
init_X11();
|
init_X11();
|
||||||
#endif /* X11 */
|
#endif /* X11 */
|
||||||
|
|
||||||
/* load current_config or CONFIG_FILE */
|
/* load current_config, CONFIG_FILE or SYSTEM_CONFIG_FILE */
|
||||||
|
|
||||||
#ifdef CONFIG_FILE
|
if (!current_config) {
|
||||||
if (current_config == NULL) {
|
|
||||||
/* load default config file */
|
/* load default config file */
|
||||||
char buf[256];
|
char buf[256];
|
||||||
|
FILE *fp;
|
||||||
|
|
||||||
variable_substitute(CONFIG_FILE, buf, 256);
|
/* Try to use personal config file first */
|
||||||
|
variable_substitute(CONFIG_FILE, buf, sizeof(buf));
|
||||||
|
if (buf[0] && (fp=fopen(buf,"r"))) {
|
||||||
|
current_config = strdup(buf);
|
||||||
|
fclose(fp);
|
||||||
|
}
|
||||||
|
|
||||||
if (buf[0] != '\0')
|
/* Try to use system config file if personal config not readable */
|
||||||
current_config = strdup(buf);
|
if (!current_config && (fp=fopen(SYSTEM_CONFIG_FILE,"r"))) {
|
||||||
|
current_config = strdup(SYSTEM_CONFIG_FILE);
|
||||||
|
fclose(fp);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* No readable config found */
|
||||||
|
if (!current_config)
|
||||||
|
CRIT_ERR("no readable personal or system-wide config file found");
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
if (current_config != NULL && fopen((const char *)current_config, (const char *)"r"))
|
load_config_file(current_config);
|
||||||
load_config_file(current_config);
|
|
||||||
else {
|
|
||||||
set_default_configurations();
|
|
||||||
}
|
|
||||||
|
|
||||||
/* init specials array */
|
/* init specials array */
|
||||||
if ((specials = calloc (sizeof(struct special_t), max_specials)) == 0)
|
if ((specials = calloc (sizeof(struct special_t), max_specials)) == 0)
|
||||||
@@ -7825,7 +7796,7 @@ int main(int argc, char **argv)
|
|||||||
#endif
|
#endif
|
||||||
#endif /* X11 */
|
#endif /* X11 */
|
||||||
case 't':
|
case 't':
|
||||||
if (text != original_text)
|
if (!text)
|
||||||
free(text);
|
free(text);
|
||||||
text = strdup(optarg);
|
text = strdup(optarg);
|
||||||
convert_escapes(text);
|
convert_escapes(text);
|
||||||
@@ -7864,7 +7835,7 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
/* generate text and get initial size */
|
/* generate text and get initial size */
|
||||||
extract_variable_text(text);
|
extract_variable_text(text);
|
||||||
if (text != original_text) {
|
if (!text) {
|
||||||
free(text);
|
free(text);
|
||||||
}
|
}
|
||||||
text = NULL;
|
text = NULL;
|
||||||
|
Reference in New Issue
Block a user