mirror of
https://github.com/Llewellynvdm/conky.git
synced 2025-03-29 22:22:21 +00:00
Merge branch 'master' into imlib2
Conflicts: src/Makefile.am
This commit is contained in:
commit
18b174e967
1
.gitignore
vendored
1
.gitignore
vendored
@ -35,3 +35,4 @@ doc/*.html
|
||||
doc/*.mxml
|
||||
patches/
|
||||
doc/conky.1
|
||||
README
|
||||
|
7
AUTHORS
7
AUTHORS
@ -1,4 +1,6 @@
|
||||
NOTE: Since moving to Git, I am no longer going to continue to update this file (in favour of Git's log stuff).
|
||||
NOTE: Since moving to Git, I am no longer going to continue to update this file
|
||||
(in favour of Git's log stuff). If you want to add yourself here when you
|
||||
submit a patch, feel free.
|
||||
|
||||
Authors of conky in alphapetical order (please, send mail if I forgot
|
||||
somebody or email address / name is wrong):
|
||||
@ -121,6 +123,9 @@ Henri H
|
||||
hinokind <hinokind at users dot sourceforge dot net>
|
||||
support negative values in human_readable()
|
||||
|
||||
Jaromir Smrcek <jaromir dot smrcek at zoner dot com>
|
||||
APC UPS daemon support
|
||||
|
||||
Jason Mitchell <jason.mitchell03 at saintleo dot edu>
|
||||
developer
|
||||
UTF8 fix
|
||||
|
@ -1,3 +1,10 @@
|
||||
2009-05-11
|
||||
* Added arguments to hwmon for value precalculation
|
||||
|
||||
2009-05-10
|
||||
* Added support for APC UPS daemon monitoring
|
||||
* Fixed hwmon for kernel 2.6.29
|
||||
|
||||
2009-05-09
|
||||
* Allow the use of '#' for comments within text area (can be escaped with
|
||||
'\#'
|
||||
|
45
README.git-version
Normal file
45
README.git-version
Normal file
@ -0,0 +1,45 @@
|
||||
QUICK & EASY:
|
||||
$ sh autogen.sh
|
||||
$ ./configure
|
||||
$ make
|
||||
$ ./src/conky # to run Conky
|
||||
# make install
|
||||
|
||||
First, read the README. This contains instructions specific to building conky
|
||||
fresh from the git repo:
|
||||
|
||||
* Conky requires three "auto-tools", with at least the specific version numbers.
|
||||
Make sure these are installed:
|
||||
|
||||
aclocal-1.9
|
||||
automake-1.9
|
||||
autoconf-2.59
|
||||
|
||||
* NOTE: You may also need to install docbook2X for generating the
|
||||
documentation. Conky will check for the following programs in PATH during
|
||||
configuration:
|
||||
|
||||
db2x_xsltproc
|
||||
db2x_manxml
|
||||
xsltproc
|
||||
|
||||
* In the directory where you cloned conky from git,
|
||||
run "aclocal", "automake", and then "autoconf".
|
||||
Make sure you run those commands with the latest versions...
|
||||
it is very possible that older versions are installed, and
|
||||
plain "automake" really means automake-1.4, not what we want,
|
||||
but "automake-1.9" instead.
|
||||
Use the "--version" option to check the program version, i.e.
|
||||
"autoconf --version".
|
||||
|
||||
You can also try using the autogen.sh script, like so:
|
||||
|
||||
$ sh autogen.sh
|
||||
|
||||
* After that, it's the familiar
|
||||
|
||||
$ ./configure
|
||||
$ make
|
||||
# make install
|
||||
|
||||
You might have to do the last step as root.
|
@ -44,6 +44,7 @@ else
|
||||
# generate configure.ac with substituted git revision
|
||||
sed -e "s/@REVISION@/${revision}/g" < "configure.ac.in" > "configure.ac"
|
||||
|
||||
touch README # in case it doesn't exist
|
||||
echo Running $ACLOCAL -I m4 ... && $ACLOCAL -I m4
|
||||
echo Running $LIBTOOLIZE --force --copy ... && $LIBTOOLIZE --force --copy
|
||||
echo Running $AUTOHEADER ... && $AUTOHEADER
|
||||
|
172
check_docs.py
172
check_docs.py
@ -1,12 +1,17 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
#
|
||||
# TODO: finish this to update nano/vim syntax files, and also handle config
|
||||
# settings.
|
||||
# This script will check the documentation consistency against the code. It
|
||||
# doesn't check the actual accuracy of the documentation, it just ensures that
|
||||
# everything is documented and that nothing which doesn't exist in Conky
|
||||
# appears in the documentation.
|
||||
#
|
||||
# This script also updates the vim and nano syntax files so it doesn't have to
|
||||
# be done manually.
|
||||
#
|
||||
|
||||
import os.path
|
||||
import re
|
||||
import sys
|
||||
|
||||
file_names = dict()
|
||||
file_names["text_objects"] = "src/text_object.h"
|
||||
@ -21,6 +26,10 @@ for fn in file_names.values():
|
||||
print "'%s' doesn't exist, or isn't a file" % (fn)
|
||||
exit(0)
|
||||
|
||||
#
|
||||
# Do all the objects first
|
||||
#
|
||||
|
||||
objects = []
|
||||
|
||||
file = open(file_names["text_objects"], "r")
|
||||
@ -35,9 +44,11 @@ while file:
|
||||
if not re.match("color\d", obj) and obj != "text":
|
||||
# ignore colourN stuff
|
||||
objects.append(res.group(1))
|
||||
file.close()
|
||||
|
||||
doc_objects = []
|
||||
exp = re.compile("\s*<command><option>(\w*)</option></command>.*")
|
||||
print "checking docs -> objs consistency (in %s)" % (file_names["text_objects"])
|
||||
file = open(file_names["variables"], "r")
|
||||
while file:
|
||||
line = file.readline()
|
||||
@ -46,9 +57,158 @@ while file:
|
||||
res = exp.match(line)
|
||||
if res:
|
||||
doc_objects.append(res.group(1))
|
||||
if doc_objects[len(doc_objects) - 1] not in objects:
|
||||
print "'%s' is documented, but doesn't seem to be an object" % (doc_objects[len(doc_objects) - 1])
|
||||
if doc_objects[len(doc_objects) - 1] != "templateN" and doc_objects[len(doc_objects) - 1] not in objects:
|
||||
print " '%s' is documented, but doesn't seem to be an object" % (doc_objects[len(doc_objects) - 1])
|
||||
file.close()
|
||||
print "done\n"
|
||||
|
||||
print "checking objs -> docs consistency (in %s)" % (file_names["variables"])
|
||||
for obj in objects:
|
||||
if obj not in doc_objects:
|
||||
print "'%s' seems to be undocumented" % (obj)
|
||||
print " '%s' seems to be undocumented" % (obj)
|
||||
print "done\n"
|
||||
|
||||
#
|
||||
# Now we'll do config settings
|
||||
#
|
||||
|
||||
configs = []
|
||||
|
||||
file = open(file_names["conky"], "r")
|
||||
exp1 = re.compile('\s*CONF\("(\w*)".*')
|
||||
exp2 = re.compile('\s*CONF2\("(\w*)".*')
|
||||
exp3 = re.compile('\s*CONF3\("(\w*)".*')
|
||||
while file:
|
||||
line = file.readline()
|
||||
if len(line) == 0:
|
||||
break
|
||||
res = exp1.match(line)
|
||||
if not res:
|
||||
res = exp2.match(line)
|
||||
if not res:
|
||||
res = exp3.match(line)
|
||||
if res:
|
||||
conf = res.group(1)
|
||||
if re.match("color\d", conf):
|
||||
conf = "colorN"
|
||||
if configs.count(conf) == 0:
|
||||
configs.append(conf)
|
||||
file.close()
|
||||
|
||||
doc_configs = []
|
||||
exp = re.compile("\s*<term><command><option>(\w*)</option></command>.*")
|
||||
print "checking docs -> configs consistency (in %s)" % (file_names["conky"])
|
||||
file = open(file_names["config_settings"], "r")
|
||||
while file:
|
||||
line = file.readline()
|
||||
if len(line) == 0:
|
||||
break
|
||||
res = exp.match(line)
|
||||
if res:
|
||||
doc_configs.append(res.group(1))
|
||||
if doc_configs[len(doc_configs) - 1] != "TEXT" and doc_configs[len(doc_configs) - 1] != "templateN" and doc_configs[len(doc_configs) - 1] not in configs:
|
||||
print " '%s' is documented, but doesn't seem to be a config setting" % (doc_configs[len(doc_configs) - 1])
|
||||
file.close()
|
||||
print "done\n"
|
||||
|
||||
print "checking configs -> docs consistency (in %s)" % (file_names["config_settings"])
|
||||
for obj in configs:
|
||||
if obj != "text" and obj != "template" and obj not in doc_configs:
|
||||
print " '%s' seems to be undocumented" % (obj)
|
||||
print "done\n"
|
||||
|
||||
|
||||
|
||||
# Cheat and add the colour/template stuff.
|
||||
|
||||
for i in range(0, 10):
|
||||
objects.append("color" + str(i))
|
||||
configs.append("color" + str(i))
|
||||
objects.append("template" + str(i))
|
||||
configs.append("template" + str(i))
|
||||
|
||||
# Finally, sort everything.
|
||||
objects.sort()
|
||||
configs.sort()
|
||||
|
||||
#
|
||||
# Update nano syntax stuff
|
||||
#
|
||||
|
||||
print "updating nano syntax...",
|
||||
sys.stdout.flush()
|
||||
file = open(file_names["nano_syntax"], "rw+")
|
||||
lines = []
|
||||
while file:
|
||||
line = file.readline()
|
||||
if len(line) == 0:
|
||||
break
|
||||
lines.append(line)
|
||||
|
||||
# find the line we want to update
|
||||
for line in lines:
|
||||
if re.match("color green ", line):
|
||||
idx = lines.index(line)
|
||||
lines.pop(idx) # remove old line
|
||||
line = 'color green "\<('
|
||||
for obj in configs:
|
||||
line += "%s|" % (obj)
|
||||
line = line[:len(line) - 1]
|
||||
line += ')\>"\n'
|
||||
lines.insert(idx, line)
|
||||
if re.match("color brightblue ", line):
|
||||
idx = lines.index(line)
|
||||
lines.pop(idx) # remove old line
|
||||
line = 'color brightblue "\<('
|
||||
for obj in objects:
|
||||
line += "%s|" % (obj)
|
||||
line = line[:len(line) - 1]
|
||||
line += ')\>"\n'
|
||||
lines.insert(idx, line)
|
||||
break # want to ignore everything after this line
|
||||
file.truncate(0)
|
||||
file.seek(0)
|
||||
file.writelines(lines)
|
||||
file.close()
|
||||
print "done."
|
||||
|
||||
#
|
||||
# Update vim syntax stuff
|
||||
#
|
||||
|
||||
print "updating vim syntax...",
|
||||
sys.stdout.flush()
|
||||
file = open(file_names["vim_syntax"], "rw+")
|
||||
lines = []
|
||||
while file:
|
||||
line = file.readline()
|
||||
if len(line) == 0:
|
||||
break
|
||||
lines.append(line)
|
||||
|
||||
# find the line we want to update
|
||||
for line in lines:
|
||||
if re.match("syn keyword ConkyrcSetting ", line):
|
||||
idx = lines.index(line)
|
||||
lines.pop(idx) # remove old line
|
||||
line = 'syn keyword ConkyrcSetting '
|
||||
for obj in configs:
|
||||
line += "%s " % (obj)
|
||||
line = line[:len(line) - 1]
|
||||
line += '\n'
|
||||
lines.insert(idx, line)
|
||||
if re.match("syn keyword ConkyrcVarName contained nextgroup=ConkyrcNumber,ConkyrcColour skipwhite ", line):
|
||||
idx = lines.index(line)
|
||||
lines.pop(idx) # remove old line
|
||||
line = 'syn keyword ConkyrcVarName contained nextgroup=ConkyrcNumber,ConkyrcColour skipwhite '
|
||||
for obj in objects:
|
||||
line += "%s " % (obj)
|
||||
line = line[:len(line) - 1]
|
||||
line += '\n'
|
||||
lines.insert(idx, line)
|
||||
break # want to ignore everything after this line
|
||||
file.truncate(0)
|
||||
file.seek(0)
|
||||
file.writelines(lines)
|
||||
file.close()
|
||||
print "done."
|
||||
|
@ -213,6 +213,26 @@ dnl
|
||||
dnl Math
|
||||
dnl
|
||||
|
||||
|
||||
dnl
|
||||
dnl Apcupsd
|
||||
dnl
|
||||
|
||||
AC_ARG_ENABLE([apcupsd],
|
||||
AC_HELP_STRING([--disable-apcupsd],
|
||||
[disable if you do not want apcupsd support @<:@default=yes@:>@]),
|
||||
[want_apcupsd="$enableval"], [want_apcupsd=yes])
|
||||
|
||||
AM_CONDITIONAL(BUILD_APCUPSD, test x$want_apcupsd = xyes)
|
||||
if test x$want_apcupsd = xyes; then
|
||||
if test x"$uname" != xLinux; then
|
||||
AC_MSG_NOTICE([apcupsd not supported on $uname... disabling])
|
||||
want_apcupsd=no
|
||||
else
|
||||
AC_DEFINE(APCUPSD, 1, [Define if you want apcupsd support])
|
||||
fi
|
||||
fi
|
||||
|
||||
AC_ARG_ENABLE([math],
|
||||
AC_HELP_STRING([--disable-math], [disable if you do not want math support @<:@default=yes@:>@]),
|
||||
[want_math="$enableval"], [want_math=yes])
|
||||
@ -767,4 +787,5 @@ $PACKAGE $VERSION configured successfully:
|
||||
config-output: $want_config_output
|
||||
IMLIB2: $want_imlib2
|
||||
ALSA mixer: $want_alsa
|
||||
apcupsd: $want_apcupsd
|
||||
EOF
|
||||
|
@ -34,6 +34,13 @@
|
||||
<para></para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><command><option>-C | --print-config</option></command></term>
|
||||
<listitem>
|
||||
Print builtin default config to stdout. See also the section EXAMPLES for more information.
|
||||
<para></para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><command><option>-d | --daemonize</option></command></term>
|
||||
<listitem>
|
||||
|
@ -9,7 +9,7 @@
|
||||
<varlistentry>
|
||||
<term><command><option>alignment</option></command></term>
|
||||
<listitem>
|
||||
Aligned position on screen, may be top_left, top_right, top_middle, bottom_left, bottom_right, bottom_middle, middle_left, middle_right, or none (also can be abreviated as tl, tr, tm, bl, br, bm, ml, mr)
|
||||
Aligned position on screen, may be top_left, top_right, top_middle, bottom_left, bottom_right, bottom_middle, middle_left, middle_right, or none (also can be abreviated as tl, tr, tm, bl, br, bm, ml, mr). See also gap_x and gap_y.
|
||||
<para></para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
@ -146,6 +146,13 @@
|
||||
<para></para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><command><option>display</option></command></term>
|
||||
<listitem>
|
||||
Specify an X display to connect to.
|
||||
<para></para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><command><option>font</option></command></term>
|
||||
<listitem>
|
||||
@ -157,7 +164,7 @@
|
||||
<term><command><option>gap_x</option></command></term>
|
||||
<listitem>
|
||||
Gap, in pixels, between right or left border of screen, same as passing -x at command line,
|
||||
e.g. gap_x 10
|
||||
e.g. gap_x 10. For other position related stuff, see 'alignment'.
|
||||
<para></para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
@ -165,7 +172,7 @@
|
||||
<term><command><option>gap_y</option></command></term>
|
||||
<listitem>
|
||||
Gap, in pixels, between top or bottom border of screen, same as passing -y at command line,
|
||||
e.g. gap_y 10.
|
||||
e.g. gap_y 10. For other position related stuff, see 'alignment'.
|
||||
<para></para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
|
16
doc/docs.xml
16
doc/docs.xml
@ -190,12 +190,26 @@
|
||||
<listitem>Start Conky to background at coordinates (5, 500).</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><varname>conky </varname><option>-C > ~/.conkyrc</option></term>
|
||||
<listitem>Do not start Conky, but have it output the builtin default config file to ~/.conkyrc for later customising.</listitem>
|
||||
</varlistentry>
|
||||
|
||||
</variablelist>
|
||||
</refsect1>
|
||||
|
||||
<refsect1>
|
||||
<title>Files</title>
|
||||
<filename>~/.conkyrc</filename> default configuration file
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><filename>${sysconfdir}/conky/conky.conf</filename></term>
|
||||
<listitem>Default system-wide configuration file. The value of ${sysconfdir} depends on the compile-time options (most likely /etc).</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><filename>~/.conkyrc</filename></term>
|
||||
<listitem>Default personal configuration file.</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</refsect1>
|
||||
|
||||
<refsect1>
|
||||
|
@ -85,6 +85,144 @@
|
||||
<para></para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>
|
||||
<command><option>apcupsd</option></command>
|
||||
<option>host</option>
|
||||
<option>port</option>
|
||||
</term>
|
||||
<listitem>
|
||||
Sets up the connection to apcupsd daemon. Prints nothing, defaults to localhost:3551
|
||||
<para></para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>
|
||||
<command><option>apcupsd_name</option></command>
|
||||
</term>
|
||||
<listitem>
|
||||
Prints the UPS user-defined name.
|
||||
<para></para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>
|
||||
<command><option>apcupsd_model</option></command>
|
||||
</term>
|
||||
<listitem>
|
||||
Prints the model of the UPS.
|
||||
<para></para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>
|
||||
<command><option>apcupsd_upsmode</option></command>
|
||||
</term>
|
||||
<listitem>
|
||||
Prints the UPS mode (e.g. standalone).
|
||||
<para></para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>
|
||||
<command><option>apcupsd_cable</option></command>
|
||||
</term>
|
||||
<listitem>
|
||||
Prints the UPS connection type.
|
||||
<para></para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>
|
||||
<command><option>apcupsd_status</option></command>
|
||||
</term>
|
||||
<listitem>
|
||||
Prints current status (on-line, on-battery).
|
||||
<para></para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>
|
||||
<command><option>apcupsd_linev</option></command>
|
||||
</term>
|
||||
<listitem>
|
||||
Nominal input voltage.
|
||||
<para></para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>
|
||||
<command><option>apcupsd_load</option></command>
|
||||
</term>
|
||||
<listitem>
|
||||
Current load in percent.
|
||||
<para></para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>
|
||||
<command><option>apcupsd_loadbar</option></command>
|
||||
</term>
|
||||
<listitem>
|
||||
Bar showing current load.
|
||||
<para></para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>
|
||||
<command><option>apcupsd_loadgraph</option></command>
|
||||
</term>
|
||||
<listitem>
|
||||
History graph of current load.
|
||||
<para></para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>
|
||||
<command><option>apcupsd_loadgauge</option></command>
|
||||
<option>(height),(width)</option>
|
||||
</term>
|
||||
<listitem>
|
||||
Gauge that shows current load.
|
||||
<para></para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>
|
||||
<command><option>apcupsd_charge</option></command>
|
||||
</term>
|
||||
<listitem>
|
||||
Current battery capacity in percent.
|
||||
<para></para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>
|
||||
<command><option>apcupsd_timeleft</option></command>
|
||||
</term>
|
||||
<listitem>
|
||||
Time left to run on battery.
|
||||
<para></para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>
|
||||
<command><option>apcupsd_temp</option></command>
|
||||
</term>
|
||||
<listitem>
|
||||
Current internal temperature.
|
||||
<para></para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>
|
||||
<command><option>apcupsd_lastxfer</option></command>
|
||||
</term>
|
||||
<listitem>
|
||||
Reason for last transfer from line to battery.
|
||||
<para></para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>
|
||||
<command><option>apm_adapter</option></command>
|
||||
@ -877,10 +1015,10 @@
|
||||
<varlistentry>
|
||||
<term>
|
||||
<command><option>hwmon</option></command>
|
||||
<option>(dev) type n</option>
|
||||
<option>(dev) type n (factor offset)</option>
|
||||
</term>
|
||||
<listitem>
|
||||
Hwmon sensor from sysfs (Linux 2.6). Parameter dev may be omitted if you have only one hwmon device. Parameter type is either 'in' or 'vol' meaning voltage; 'fan' meaning fan; 'temp' meaning temperature. Parameter n is number of the sensor. See /sys/class/hwmon/ on your local computer.
|
||||
Hwmon sensor from sysfs (Linux 2.6). Parameter dev may be omitted if you have only one hwmon device. Parameter type is either 'in' or 'vol' meaning voltage; 'fan' meaning fan; 'temp' meaning temperature. Parameter n is number of the sensor. See /sys/class/hwmon/ on your local computer. The optional arguments 'factor' and 'offset' allow precalculation of the raw input, which is being modified as follows: 'input = input * factor + offset'. Note that they have to be given as decimal values (i.e. contain at least one decimal place).
|
||||
<para></para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
|
@ -5,14 +5,13 @@
|
||||
syntax "conky" "(\.*conkyrc.*$|conky.conf)"
|
||||
|
||||
## Configuration items
|
||||
color green "\<(alias|alignment|background|show_graph_range|show_graph_scale|border_margin|border_width|color0|color1|color2|color3|color4|color5|color6|color7|color8|color9|default_bar_size|default_gauge_size|default_graph_size|default_color|default_shade_color|default_shadecolor|default_outline_color|default_outlinecolor|imap|pop3|mpd_host|mpd_port|mpd_password|music_player_interval|sensor_device|cpu_avg_samples|net_avg_samples|double_buffer|override_utf8_locale|draw_borders|draw_graph_borders|draw_shades|draw_outline|out_to_console|out_to_stderr|out_to_x|extra_newline|overwrite_file|append_file|use_spacer|use_xft|font|xftalpha|xftfont|use_xft|gap_x|gap_y|mail_spool|minimum_size|maximum_width|no_buffers|template0|template1|template2|template3|template4|template5|template6|template7|template8|template9|top_name_width|top_cpu_separate|short_units|pad_percents|own_window|own_window_class|own_window_title|own_window_transparent|own_window_colour|own_window_hints|own_window_type|stippled_borders|temp1|temp2|update_interval|total_run_times|uppercase|max_specials|max_user_text|text_buffer_size|max_port_monitor_connections)\>"
|
||||
color green "\<(alias|alignment|append_file|background|border_margin|border_width|color0|color1|color2|color3|color4|color5|color6|color7|color8|color9|colorN|cpu_avg_samples|default_bar_size|default_color|default_gauge_size|default_graph_size|default_outline_color|default_shade_color|diskio_avg_samples|display|double_buffer|draw_borders|draw_graph_borders|draw_outline|draw_shades|font|gap_x|gap_y|if_up_strictness|imap|mail_spool|max_port_monitor_connections|max_specials|max_user_text|maximum_width|minimum_size|mpd_host|mpd_password|mpd_port|music_player_interval|net_avg_samples|no_buffers|out_to_console|out_to_stderr|out_to_x|override_utf8_locale|overwrite_file|own_window|own_window_class|own_window_colour|own_window_hints|own_window_title|own_window_transparent|own_window_type|pad_percents|pop3|sensor_device|short_units|show_graph_range|show_graph_scale|stippled_borders|temperature_unit|template|template0|template1|template2|template3|template4|template5|template6|template7|template8|template9|text|text_buffer_size|top_cpu_separate|top_name_width|total_run_times|update_interval|uppercase|use_spacer|use_xft|xftalpha|xftfont)\>"
|
||||
|
||||
## Configuration item constants
|
||||
color yellow "\<(above|below|bottom_left|bottom_right|bottom_middle|desktop|dock|no|none|normal|override|skip_pager|skip_taskbar|sticky|top_left|top_right|top_middle|middle_left|middle_right|undecorated|yes)\>"
|
||||
|
||||
## Variables
|
||||
color brightblue "\<(acpitemp|acpitempf|freq|freq_g|voltage_mv|voltage_v|wireless_essid|wireless_mode|wireless_bitrate|wireless_ap|wireless_link_qual|wireless_link_qual_max|wireless_link_qual_perc|wireless_link_bar|freq_dyn|freq_dyn_g|adt746xcpu|adt746xfan|acpifan|acpiacadapter|battery|battery_time|battery_percent|battery_bar|buffers|cached|cpu|cpubar|cpugraph|loadgraph|lines|color|color0|color1|color2|color3|color4|color5|color6|color7|color8|color9|combine|conky_version|conky_build_date|conky_build_arch|disk_protect|i8k_version|i8k_bios|i8k_serial|i8k_cpu_temp|i8k_cpu_tempf|i8k_left_fan_status|i8k_right_fan_status|i8k_left_fan_rpm|i8k_right_fan_rpm|i8k_ac_status|i8k_buttons_status|ibm_fan|ibm_temps|ibm_volume|ibm_brightness|if_up|if_updatenr|if_gw|gw_iface|gw_ip|laptop_mode|pb_battery|obsd_sensors_temp|obsd_sensors_fan|obsd_sensors_volt|obsd_vendor|obsd_product|font|diskio|diskio_write|diskio_read|diskiograph|diskiograph_read|diskiograph_write|downspeed|downspeedf|downspeedgraph|else|endif|addr|addrs|image|exec|execp|execbar|execgraph|execibar|execigraph|execi|execpi|texeci|imap_unseen|imap_messages|pop3_unseen|pop3_used|fs_bar|fs_free|fs_free_perc|fs_size|fs_type|fs_used|fs_bar_free|fs_used_perc|loadavg|goto|tab|hr|nameserver|rss|hddtemp|offset|voffset|i2c|platform|hwmon|alignr|alignc|if_empty|if_existing|if_mounted|if_running|ioscheduler|kernel|machine|mem|memeasyfree|memfree|memmax|memperc|membar|memgraph|mixer|mixerl|mixerr|mixerbar|mixerlbar|mixerrbar|mails|mboxscan|new_mails|nodename|outlinecolor|processes|running_processes|scroll|shadecolor|stippled_hr|swap|swapmax|swapperc|swapbar|sysname|time|utime|tztime|totaldown|totalup|updates|upspeed|upspeedf|upspeedgraph|uptime_short|uptime|user_names|user_terms|user_times|user_number|apm_adapter|apm_battery_life|apm_battery_time|monitor|monitor_number|mpd_title|mpd_artist|mpd_album|mpd_random|mpd_repeat|mpd_track|mpd_name|mpd_file|mpd_vol|mpd_bitrate|mpd_status|mpd_elapsed|mpd_length|mpd_percent|mpd_bar|mpd_smart|words|xmms2_artist|xmms2_album|xmms2_title|xmms2_genre|xmms2_comment|xmms2_url|xmms2_status|xmms2_date|xmms2_tracknr|xmms2_bitrate|xmms2_id|xmms2_size|xmms2_elapsed|xmms2_duration|xmms2_percent|xmms2_bar|xmms2_playlist|xmms2_timesplayed|xmms2_smart|audacious_status|audacious_title|audacious_length|audacious_length_seconds|audacious_position|audacious_position_seconds|audacious_bitrate|audacious_frequency|audacious_channels|audacious_filename|audacious_playlist_length|audacious_playlist_position|audacious_bar|bmpx_title|bmpx_artist|bmpx_album|bmpx_uri|bmpx_track|bmpx_bitrate|top|top_mem|tail|head|tcp_portmon|iconv_start|iconv_stop|entropy_avail|entropy_poolsize|entropy_bar|smapi|if_smapi_bat_installed|smapi_bat_perc|smapi_bat_bar)\>"
|
||||
|
||||
color brightblue "\<(acpiacadapter|acpifan|acpitemp|addr|addrs|adt746xcpu|adt746xfan|alignc|alignr|apcupsd|apcupsd_cable|apcupsd_charge|apcupsd_lastxfer|apcupsd_linev|apcupsd_load|apcupsd_loadbar|apcupsd_loadgauge|apcupsd_loadgraph|apcupsd_model|apcupsd_name|apcupsd_status|apcupsd_temp|apcupsd_timeleft|apcupsd_upsmode|apm_adapter|apm_battery_life|apm_battery_time|audacious_bar|audacious_bitrate|audacious_channels|audacious_filename|audacious_frequency|audacious_length|audacious_length_seconds|audacious_main_volume|audacious_playlist_length|audacious_playlist_position|audacious_position|audacious_position_seconds|audacious_status|audacious_title|battery|battery_bar|battery_percent|battery_short|battery_time|bmpx_album|bmpx_artist|bmpx_bitrate|bmpx_title|bmpx_track|bmpx_uri|buffers|cached|color|color0|color1|color2|color3|color4|color5|color6|color7|color8|color9|combine|conky_build_arch|conky_build_date|conky_version|cpu|cpubar|cpugauge|cpugraph|disk_protect|diskio|diskio_read|diskio_write|diskiograph|diskiograph_read|diskiograph_write|downspeed|downspeedf|downspeedgraph|draft_mails|else|endif|entropy_avail|entropy_bar|entropy_poolsize|eval|eve|exec|execbar|execgauge|execgraph|execi|execibar|execigauge|execigraph|execp|execpi|flagged_mails|font|forwarded_mails|freq|freq_g|fs_bar|fs_bar_free|fs_free|fs_free_perc|fs_size|fs_type|fs_used|fs_used_perc|goto|gw_iface|gw_ip|hddtemp|head|hr|hwmon|i2c|i8k_ac_status|i8k_bios|i8k_buttons_status|i8k_cpu_temp|i8k_left_fan_rpm|i8k_left_fan_status|i8k_right_fan_rpm|i8k_right_fan_status|i8k_serial|i8k_version|ibm_brightness|ibm_fan|ibm_temps|ibm_volume|iconv_start|iconv_stop|if_empty|if_existing|if_gw|if_match|if_mixer_mute|if_mounted|if_mpd_playing|if_running|if_smapi_bat_installed|if_up|if_updatenr|if_xmms2_connected|image|imap_messages|imap_unseen|ioscheduler|kernel|laptop_mode|lines|loadavg|loadgraph|machine|mails|mboxscan|mem|membar|memeasyfree|memfree|memgauge|memgraph|memmax|memperc|mixer|mixerbar|mixerl|mixerlbar|mixerr|mixerrbar|moc_album|moc_artist|moc_bitrate|moc_curtime|moc_file|moc_rate|moc_song|moc_state|moc_timeleft|moc_title|moc_totaltime|monitor|monitor_number|mpd_album|mpd_artist|mpd_bar|mpd_bitrate|mpd_elapsed|mpd_file|mpd_length|mpd_name|mpd_percent|mpd_random|mpd_repeat|mpd_smart|mpd_status|mpd_title|mpd_track|mpd_vol|nameserver|new_mails|nodename|nvidia|obsd_product|obsd_sensors_fan|obsd_sensors_temp|obsd_sensors_volt|obsd_vendor|offset|outlinecolor|pb_battery|platform|pop3_unseen|pop3_used|pre_exec|processes|replied_mails|rss|running_processes|scroll|seen_mails|shadecolor|smapi|smapi_bat_bar|smapi_bat_perc|smapi_bat_power|smapi_bat_temp|sony_fanspeed|stippled_hr|swap|swapbar|swapmax|swapperc|sysname|tab|tail|tcp_portmon|template0|template1|template2|template3|template4|template5|template6|template7|template8|template9|texeci|time|top|top_mem|top_time|totaldown|totalup|trashed_mails|tztime|unflagged_mails|unforwarded_mails|unreplied_mails|unseen_mails|updates|upspeed|upspeedf|upspeedgraph|uptime|uptime_short|user_names|user_number|user_terms|user_times|utime|voffset|voltage_mv|voltage_v|wireless_ap|wireless_bitrate|wireless_essid|wireless_link_bar|wireless_link_qual|wireless_link_qual_max|wireless_link_qual_perc|wireless_mode|words|xmms2_album|xmms2_artist|xmms2_bar|xmms2_bitrate|xmms2_comment|xmms2_date|xmms2_duration|xmms2_elapsed|xmms2_genre|xmms2_id|xmms2_percent|xmms2_playlist|xmms2_size|xmms2_smart|xmms2_status|xmms2_timesplayed|xmms2_title|xmms2_tracknr|xmms2_url)\>"
|
||||
|
||||
color brightblue "\$\{?[0-9A-Z_!@#$*?-]+\}?"
|
||||
color cyan "(\{|\}|\(|\)|\;|\]|\[|`|\\|\$|<|>|!|=|&|\|)"
|
||||
|
@ -12,96 +12,7 @@ endif
|
||||
|
||||
syn region ConkyrcComment start=/^\s*#/ end=/$/
|
||||
|
||||
syn keyword ConkyrcSetting
|
||||
\ alias
|
||||
\ alignment
|
||||
\ background
|
||||
\ show_graph_scale
|
||||
\ show_graph_range
|
||||
\ border_margin
|
||||
\ border_width
|
||||
\ color0
|
||||
\ color1
|
||||
\ color2
|
||||
\ color3
|
||||
\ color4
|
||||
\ color5
|
||||
\ color6
|
||||
\ color7
|
||||
\ color8
|
||||
\ color9
|
||||
\ default_bar_size
|
||||
\ default_gauge_size
|
||||
\ default_graph_size
|
||||
\ default_color
|
||||
\ default_shade_color
|
||||
\ default_shadecolor
|
||||
\ default_outline_color
|
||||
\ default_outlinecolor
|
||||
\ imap
|
||||
\ pop3
|
||||
\ mpd_host
|
||||
\ mpd_port
|
||||
\ mpd_password
|
||||
\ music_player_interval
|
||||
\ sensor_device
|
||||
\ cpu_avg_samples
|
||||
\ net_avg_samples
|
||||
\ double_buffer
|
||||
\ override_utf8_locale
|
||||
\ draw_borders
|
||||
\ draw_graph_borders
|
||||
\ draw_shades
|
||||
\ draw_outline
|
||||
\ out_to_console
|
||||
\ out_to_stderr
|
||||
\ out_to_x
|
||||
\ overwrite_file
|
||||
\ append_file
|
||||
\ use_spacer
|
||||
\ use_xft
|
||||
\ font
|
||||
\ xftalpha
|
||||
\ xftfont
|
||||
\ use_xft
|
||||
\ gap_x
|
||||
\ gap_y
|
||||
\ mail_spool
|
||||
\ minimum_size
|
||||
\ maximum_width
|
||||
\ no_buffers
|
||||
\ top_name_width
|
||||
\ top_cpu_separate
|
||||
\ short_units
|
||||
\ pad_percents
|
||||
\ own_window
|
||||
\ own_window_class
|
||||
\ own_window_title
|
||||
\ own_window_transparent
|
||||
\ own_window_colour
|
||||
\ own_window_hints
|
||||
\ own_window_type
|
||||
\ stippled_borders
|
||||
\ temp1
|
||||
\ temp2
|
||||
\ update_interval
|
||||
\ template0
|
||||
\ template1
|
||||
\ template2
|
||||
\ template3
|
||||
\ template4
|
||||
\ template5
|
||||
\ template6
|
||||
\ template7
|
||||
\ template8
|
||||
\ template9
|
||||
\ total_run_times
|
||||
\ uppercase
|
||||
\ max_specials
|
||||
\ max_user_text
|
||||
\ text_buffer_size
|
||||
\ text
|
||||
\ max_port_monitor_connections
|
||||
syn keyword ConkyrcSetting alias alignment append_file background border_margin border_width color0 color1 color2 color3 color4 color5 color6 color7 color8 color9 colorN cpu_avg_samples default_bar_size default_color default_gauge_size default_graph_size default_outline_color default_shade_color diskio_avg_samples display double_buffer draw_borders draw_graph_borders draw_outline draw_shades font gap_x gap_y if_up_strictness imap mail_spool max_port_monitor_connections max_specials max_user_text maximum_width minimum_size mpd_host mpd_password mpd_port music_player_interval net_avg_samples no_buffers out_to_console out_to_stderr out_to_x override_utf8_locale overwrite_file own_window own_window_class own_window_colour own_window_hints own_window_title own_window_transparent own_window_type pad_percents pop3 sensor_device short_units show_graph_range show_graph_scale stippled_borders temperature_unit template template0 template1 template2 template3 template4 template5 template6 template7 template8 template9 text text_buffer_size top_cpu_separate top_name_width total_run_times update_interval uppercase use_spacer use_xft xftalpha xftfont
|
||||
|
||||
syn keyword ConkyrcConstant
|
||||
\ above
|
||||
@ -138,265 +49,7 @@ syn region ConkyrcVar start=/\$\w\@=/ end=/\W\@=\|$/ contained contains=ConkyrcV
|
||||
|
||||
syn match ConkyrcVarStuff /{\@<=/ms=s contained nextgroup=ConkyrcVarName
|
||||
|
||||
syn keyword ConkyrcVarName contained nextgroup=ConkyrcNumber,ConkyrcColour skipwhite
|
||||
\ acpitemp
|
||||
\ acpitempf
|
||||
\ freq
|
||||
\ freq_g
|
||||
\ voltage_mv
|
||||
\ voltage_v
|
||||
\ wireless_essid
|
||||
\ wireless_mode
|
||||
\ wireless_bitrate
|
||||
\ wireless_ap
|
||||
\ wireless_link_qual
|
||||
\ wireless_link_qual_max
|
||||
\ wireless_link_qual_perc
|
||||
\ wireless_link_bar
|
||||
\ freq_dyn
|
||||
\ freq_dyn_g
|
||||
\ adt746xcpu
|
||||
\ adt746xfan
|
||||
\ acpifan
|
||||
\ acpiacadapter
|
||||
\ battery
|
||||
\ battery_time
|
||||
\ battery_percent
|
||||
\ battery_bar
|
||||
\ buffers
|
||||
\ cached
|
||||
\ cpu
|
||||
\ cpubar
|
||||
\ cpugraph
|
||||
\ loadgraph
|
||||
\ color
|
||||
\ color0
|
||||
\ color1
|
||||
\ color2
|
||||
\ color3
|
||||
\ color4
|
||||
\ color5
|
||||
\ color6
|
||||
\ color7
|
||||
\ color8
|
||||
\ color9
|
||||
\ combine
|
||||
\ conky_version
|
||||
\ conky_build_date
|
||||
\ conky_build_arch
|
||||
\ disk_protect
|
||||
\ i8k_version
|
||||
\ i8k_bios
|
||||
\ i8k_serial
|
||||
\ i8k_cpu_temp
|
||||
\ i8k_cpu_tempf
|
||||
\ i8k_left_fan_status
|
||||
\ i8k_right_fan_status
|
||||
\ i8k_left_fan_rpm
|
||||
\ i8k_right_fan_rpm
|
||||
\ i8k_ac_status
|
||||
\ i8k_buttons_status
|
||||
\ ibm_fan
|
||||
\ ibm_temps
|
||||
\ ibm_volume
|
||||
\ ibm_brightness
|
||||
\ if_up
|
||||
\ if_updatenr
|
||||
\ if_gw
|
||||
\ gw_iface
|
||||
\ gw_ip
|
||||
\ laptop_mode
|
||||
\ pb_battery
|
||||
\ obsd_sensors_temp
|
||||
\ obsd_sensors_fan
|
||||
\ obsd_sensors_volt
|
||||
\ obsd_vendor
|
||||
\ obsd_product
|
||||
\ font
|
||||
\ diskio
|
||||
\ diskio_write
|
||||
\ diskio_read
|
||||
\ diskiograph
|
||||
\ diskiograph_read
|
||||
\ diskiograph_write
|
||||
\ downspeed
|
||||
\ downspeedf
|
||||
\ downspeedgraph
|
||||
\ else
|
||||
\ endif
|
||||
\ addr
|
||||
\ addrs
|
||||
\ image
|
||||
\ exec
|
||||
\ execp
|
||||
\ execbar
|
||||
\ execgraph
|
||||
\ execibar
|
||||
\ execigraph
|
||||
\ execi
|
||||
\ execpi
|
||||
\ texeci
|
||||
\ imap_unseen
|
||||
\ imap_messages
|
||||
\ pop3_unseen
|
||||
\ pop3_used
|
||||
\ fs_bar
|
||||
\ fs_free
|
||||
\ fs_free_perc
|
||||
\ fs_size
|
||||
\ fs_type
|
||||
\ fs_used
|
||||
\ fs_bar_free
|
||||
\ fs_used_perc
|
||||
\ loadavg
|
||||
\ goto
|
||||
\ tab
|
||||
\ hr
|
||||
\ nameserver
|
||||
\ rss
|
||||
\ hddtemp
|
||||
\ offset
|
||||
\ voffset
|
||||
\ i2c
|
||||
\ platform
|
||||
\ hwmon
|
||||
\ alignr
|
||||
\ alignc
|
||||
\ if_empty
|
||||
\ if_existing
|
||||
\ if_mounted
|
||||
\ if_running
|
||||
\ ioscheduler
|
||||
\ kernel
|
||||
\ machine
|
||||
\ mem
|
||||
\ memeasyfree
|
||||
\ memfree
|
||||
\ memmax
|
||||
\ memperc
|
||||
\ membar
|
||||
\ memgraph
|
||||
\ mixer
|
||||
\ mixerl
|
||||
\ mixerr
|
||||
\ mixerbar
|
||||
\ mixerlbar
|
||||
\ mixerrbar
|
||||
\ mails
|
||||
\ mboxscan
|
||||
\ new_mails
|
||||
\ nodename
|
||||
\ outlinecolor
|
||||
\ processes
|
||||
\ running_processes
|
||||
\ scroll
|
||||
\ lines
|
||||
\ words
|
||||
\ shadecolor
|
||||
\ stippled_hr
|
||||
\ swap
|
||||
\ swapmax
|
||||
\ swapperc
|
||||
\ swapbar
|
||||
\ sysname
|
||||
\ template0
|
||||
\ template1
|
||||
\ template2
|
||||
\ template3
|
||||
\ template4
|
||||
\ template5
|
||||
\ template6
|
||||
\ template7
|
||||
\ template8
|
||||
\ template9
|
||||
\ time
|
||||
\ utime
|
||||
\ tztime
|
||||
\ totaldown
|
||||
\ totalup
|
||||
\ updates
|
||||
\ upspeed
|
||||
\ upspeedf
|
||||
\ upspeedgraph
|
||||
\ uptime_short
|
||||
\ uptime
|
||||
\ user_names
|
||||
\ user_terms
|
||||
\ user_times
|
||||
\ user_number
|
||||
\ apm_adapter
|
||||
\ apm_battery_life
|
||||
\ apm_battery_time
|
||||
\ monitor
|
||||
\ monitor_number
|
||||
\ mpd_title
|
||||
\ mpd_artist
|
||||
\ mpd_album
|
||||
\ mpd_random
|
||||
\ mpd_repeat
|
||||
\ mpd_track
|
||||
\ mpd_name
|
||||
\ mpd_file
|
||||
\ mpd_vol
|
||||
\ mpd_bitrate
|
||||
\ mpd_status
|
||||
\ mpd_elapsed
|
||||
\ mpd_length
|
||||
\ mpd_percent
|
||||
\ mpd_bar
|
||||
\ mpd_smart
|
||||
\ xmms2_artist
|
||||
\ xmms2_album
|
||||
\ xmms2_title
|
||||
\ xmms2_genre
|
||||
\ xmms2_comment
|
||||
\ xmms2_url
|
||||
\ xmms2_status
|
||||
\ xmms2_date
|
||||
\ xmms2_tracknr
|
||||
\ xmms2_bitrate
|
||||
\ xmms2_id
|
||||
\ xmms2_size
|
||||
\ xmms2_elapsed
|
||||
\ xmms2_duration
|
||||
\ xmms2_percent
|
||||
\ xmms2_bar
|
||||
\ xmms2_playlist
|
||||
\ xmms2_timesplayed
|
||||
\ xmms2_smart
|
||||
\ audacious_status
|
||||
\ audacious_title
|
||||
\ audacious_length
|
||||
\ audacious_length_seconds
|
||||
\ audacious_position
|
||||
\ audacious_position_seconds
|
||||
\ audacious_bitrate
|
||||
\ audacious_frequency
|
||||
\ audacious_channels
|
||||
\ audacious_filename
|
||||
\ audacious_playlist_length
|
||||
\ audacious_playlist_position
|
||||
\ audacious_bar
|
||||
\ bmpx_title
|
||||
\ bmpx_artist
|
||||
\ bmpx_album
|
||||
\ bmpx_uri
|
||||
\ bmpx_track
|
||||
\ bmpx_bitrate
|
||||
\ top
|
||||
\ top_mem
|
||||
\ tail
|
||||
\ head
|
||||
\ tcp_portmon
|
||||
\ iconv_start
|
||||
\ iconv_stop
|
||||
\ entropy_avail
|
||||
\ entropy_poolsize
|
||||
\ entropy_bar
|
||||
\ smapi
|
||||
\ if_smapi_bat_installed
|
||||
\ smapi_bat_perc
|
||||
\ smapi_bat_bar
|
||||
syn keyword ConkyrcVarName contained nextgroup=ConkyrcNumber,ConkyrcColour skipwhite acpiacadapter acpifan acpitemp addr addrs adt746xcpu adt746xfan alignc alignr apcupsd apcupsd_cable apcupsd_charge apcupsd_lastxfer apcupsd_linev apcupsd_load apcupsd_loadbar apcupsd_loadgauge apcupsd_loadgraph apcupsd_model apcupsd_name apcupsd_status apcupsd_temp apcupsd_timeleft apcupsd_upsmode apm_adapter apm_battery_life apm_battery_time audacious_bar audacious_bitrate audacious_channels audacious_filename audacious_frequency audacious_length audacious_length_seconds audacious_main_volume audacious_playlist_length audacious_playlist_position audacious_position audacious_position_seconds audacious_status audacious_title battery battery_bar battery_percent battery_short battery_time bmpx_album bmpx_artist bmpx_bitrate bmpx_title bmpx_track bmpx_uri buffers cached color color0 color1 color2 color3 color4 color5 color6 color7 color8 color9 combine conky_build_arch conky_build_date conky_version cpu cpubar cpugauge cpugraph disk_protect diskio diskio_read diskio_write diskiograph diskiograph_read diskiograph_write downspeed downspeedf downspeedgraph draft_mails else endif entropy_avail entropy_bar entropy_poolsize eval eve exec execbar execgauge execgraph execi execibar execigauge execigraph execp execpi flagged_mails font forwarded_mails freq freq_g fs_bar fs_bar_free fs_free fs_free_perc fs_size fs_type fs_used fs_used_perc goto gw_iface gw_ip hddtemp head hr hwmon i2c i8k_ac_status i8k_bios i8k_buttons_status i8k_cpu_temp i8k_left_fan_rpm i8k_left_fan_status i8k_right_fan_rpm i8k_right_fan_status i8k_serial i8k_version ibm_brightness ibm_fan ibm_temps ibm_volume iconv_start iconv_stop if_empty if_existing if_gw if_match if_mixer_mute if_mounted if_mpd_playing if_running if_smapi_bat_installed if_up if_updatenr if_xmms2_connected image imap_messages imap_unseen ioscheduler kernel laptop_mode lines loadavg loadgraph machine mails mboxscan mem membar memeasyfree memfree memgauge memgraph memmax memperc mixer mixerbar mixerl mixerlbar mixerr mixerrbar moc_album moc_artist moc_bitrate moc_curtime moc_file moc_rate moc_song moc_state moc_timeleft moc_title moc_totaltime monitor monitor_number mpd_album mpd_artist mpd_bar mpd_bitrate mpd_elapsed mpd_file mpd_length mpd_name mpd_percent mpd_random mpd_repeat mpd_smart mpd_status mpd_title mpd_track mpd_vol nameserver new_mails nodename nvidia obsd_product obsd_sensors_fan obsd_sensors_temp obsd_sensors_volt obsd_vendor offset outlinecolor pb_battery platform pop3_unseen pop3_used pre_exec processes replied_mails rss running_processes scroll seen_mails shadecolor smapi smapi_bat_bar smapi_bat_perc smapi_bat_power smapi_bat_temp sony_fanspeed stippled_hr swap swapbar swapmax swapperc sysname tab tail tcp_portmon template0 template1 template2 template3 template4 template5 template6 template7 template8 template9 texeci time top top_mem top_time totaldown totalup trashed_mails tztime unflagged_mails unforwarded_mails unreplied_mails unseen_mails updates upspeed upspeedf upspeedgraph uptime uptime_short user_names user_number user_terms user_times utime voffset voltage_mv voltage_v wireless_ap wireless_bitrate wireless_essid wireless_link_bar wireless_link_qual wireless_link_qual_max wireless_link_qual_perc wireless_mode words xmms2_album xmms2_artist xmms2_bar xmms2_bitrate xmms2_comment xmms2_date xmms2_duration xmms2_elapsed xmms2_genre xmms2_id xmms2_percent xmms2_playlist xmms2_size xmms2_smart xmms2_status xmms2_timesplayed xmms2_title xmms2_tracknr xmms2_url
|
||||
|
||||
hi def link ConkyrcComment Comment
|
||||
hi def link ConkyrcSetting Keyword
|
||||
|
@ -115,6 +115,10 @@ if BUILD_IMLIB2
|
||||
imlib2 = imlib2.c imlib2.h
|
||||
endif
|
||||
|
||||
if BUILD_APCUPSD
|
||||
apcupsd = apcupsd.c apcupsd.h
|
||||
endif
|
||||
|
||||
conky_SOURCES = \
|
||||
$(config_output) \
|
||||
$(config_cookie) \
|
||||
@ -128,6 +132,7 @@ conky_SOURCES = \
|
||||
$(freebsd) \
|
||||
fs.c \
|
||||
$(hddtemp) \
|
||||
$(apcupsd) \
|
||||
$(linux) \
|
||||
logging.h \
|
||||
$(nvidia) \
|
||||
@ -180,6 +185,8 @@ EXTRA_DIST = \
|
||||
fs.h \
|
||||
hddtemp.c \
|
||||
hddtemp.h \
|
||||
apcupsd.c \
|
||||
apcupsd.h \
|
||||
linux.c \
|
||||
linux.h \
|
||||
libmpdclient.c \
|
||||
|
234
src/apcupsd.c
Normal file
234
src/apcupsd.c
Normal file
@ -0,0 +1,234 @@
|
||||
/* apcupsd.c: conky module for APC UPS daemon monitoring
|
||||
*
|
||||
* Copyright (C) 2009 Jaromir Smrcek <jaromir.smrcek@zoner.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
|
||||
* USA. */
|
||||
|
||||
#include "conky.h"
|
||||
#include "apcupsd.h"
|
||||
#include "logging.h"
|
||||
|
||||
#include <errno.h>
|
||||
#include <sys/time.h>
|
||||
#include <unistd.h>
|
||||
|
||||
//
|
||||
// encapsulated recv()
|
||||
//
|
||||
static int net_recv_ex(int sock, void *buf, int size, struct timeval *tv)
|
||||
{
|
||||
|
||||
fd_set fds;
|
||||
int res;
|
||||
|
||||
// wait for some data to be read
|
||||
do {
|
||||
errno = 0;
|
||||
FD_ZERO(&fds);
|
||||
FD_SET(sock, &fds);
|
||||
res = select(sock + 1, &fds, NULL, NULL, tv);
|
||||
} while (res < 0 && errno == EINTR);
|
||||
if (res < 0) return 0;
|
||||
if (res == 0) {
|
||||
// timeout
|
||||
errno = ETIMEDOUT; // select was succesfull, errno is now 0
|
||||
return 0;
|
||||
}
|
||||
|
||||
// socket ready, read the data
|
||||
do {
|
||||
errno = 0;
|
||||
res = recv(sock, (char*)buf, size, 0);
|
||||
} while (res < 0 && errno == EINTR);
|
||||
if (res < 0) return 0;
|
||||
if (res == 0) {
|
||||
// orderly shutdown
|
||||
errno = ENOTCONN;
|
||||
return 0;
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
//
|
||||
// read whole buffer or fail
|
||||
//
|
||||
static int net_recv(int sock, void* buf, int size) {
|
||||
|
||||
int todo = size;
|
||||
int off = 0;
|
||||
int len;
|
||||
struct timeval tv = { 0, 250000 };
|
||||
|
||||
while (todo) {
|
||||
len = net_recv_ex(sock, (char*)buf + off, todo, &tv);
|
||||
if (!len) return 0;
|
||||
todo -= len;
|
||||
off += len;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
//
|
||||
// get one response line
|
||||
//
|
||||
static int get_line(int sock, char line[], short linesize) {
|
||||
|
||||
// get the line length
|
||||
short sz;
|
||||
if (!net_recv(sock, &sz, sizeof(sz))) return -1;
|
||||
sz = ntohs(sz);
|
||||
if (!sz) return 0;
|
||||
|
||||
// get the line
|
||||
while (sz > linesize) {
|
||||
// this is just a hack (being lazy), this should not happen anyway
|
||||
net_recv(sock, line, linesize);
|
||||
sz -= sizeof(line);
|
||||
}
|
||||
if (!net_recv(sock, line, sz)) return 0;
|
||||
line[sz] = 0;
|
||||
return sz;
|
||||
}
|
||||
|
||||
#define FILL(NAME,FIELD,FIRST) \
|
||||
if (!strncmp(NAME, line, sizeof(NAME)-1)) { \
|
||||
strncpy(apc->items[FIELD], line+11, APCUPSD_MAXSTR); \
|
||||
/* remove trailing newline and assure termination */ \
|
||||
apc->items[FIELD][len-11 > APCUPSD_MAXSTR ? APCUPSD_MAXSTR : len-12] = 0; \
|
||||
if (FIRST) { \
|
||||
char* c; \
|
||||
for (c = apc->items[FIELD]; *c; ++c) \
|
||||
if (*c == ' ' && c > apc->items[FIELD]+2) { \
|
||||
*c = 0; \
|
||||
break; \
|
||||
} \
|
||||
} \
|
||||
}
|
||||
|
||||
//
|
||||
// fills in the data received from a socket
|
||||
//
|
||||
static int fill_items(int sock, PAPCUPSD_S apc) {
|
||||
|
||||
char line[512];
|
||||
int len;
|
||||
while ((len = get_line(sock, line, sizeof(line)))) {
|
||||
// fill the right types in
|
||||
FILL("UPSNAME", APCUPSD_NAME, FALSE);
|
||||
FILL("MODEL", APCUPSD_MODEL, FALSE);
|
||||
FILL("UPSMODE", APCUPSD_UPSMODE, FALSE);
|
||||
FILL("CABLE", APCUPSD_CABLE, FALSE);
|
||||
FILL("STATUS", APCUPSD_STATUS, FALSE);
|
||||
FILL("LINEV", APCUPSD_LINEV, TRUE);
|
||||
FILL("LOADPCT", APCUPSD_LOAD, TRUE);
|
||||
FILL("BCHARGE", APCUPSD_CHARGE, TRUE);
|
||||
FILL("TIMELEFT", APCUPSD_TIMELEFT, TRUE);
|
||||
FILL("ITEMP", APCUPSD_TEMP, TRUE);
|
||||
FILL("LASTXFER", APCUPSD_LASTXFER, FALSE);
|
||||
}
|
||||
|
||||
return len == 0;
|
||||
}
|
||||
|
||||
//
|
||||
// Conky update function for apcupsd data
|
||||
//
|
||||
void update_apcupsd(void) {
|
||||
|
||||
int i;
|
||||
APCUPSD_S apc;
|
||||
int sock;
|
||||
|
||||
for (i = 0; i < _APCUPSD_COUNT; ++i)
|
||||
memcpy(apc.items[i], "N/A", 4); // including \0
|
||||
|
||||
do {
|
||||
struct hostent* he = 0;
|
||||
struct sockaddr_in addr;
|
||||
short sz = 0;
|
||||
#ifdef HAVE_GETHOSTBYNAME_R
|
||||
struct hostent he_mem;
|
||||
int he_errno;
|
||||
char hostbuff[2048];
|
||||
#endif
|
||||
//
|
||||
// connect to apcupsd daemon
|
||||
//
|
||||
sock = socket(AF_INET, SOCK_STREAM, 0);
|
||||
if (sock < 0) {
|
||||
perror("socket");
|
||||
break;
|
||||
}
|
||||
#ifdef HAVE_GETHOSTBYNAME_R
|
||||
if (gethostbyname_r(info.apcupsd.host, &he_mem, hostbuff, sizeof(hostbuff), &he, &he_errno)) {
|
||||
ERR("APCUPSD gethostbyname_r: %s", hstrerror(h_errno));
|
||||
break;
|
||||
}
|
||||
#else /* HAVE_GETHOSTBYNAME_R */
|
||||
he = gethostbyname(info.apcupsd.host);
|
||||
if (!he) {
|
||||
herror("gethostbyname");
|
||||
break;
|
||||
}
|
||||
#endif /* HAVE_GETHOSTBYNAME_R */
|
||||
|
||||
memset(&addr, 0, sizeof(addr));
|
||||
addr.sin_family = AF_INET;
|
||||
addr.sin_port = info.apcupsd.port;
|
||||
memcpy(&addr.sin_addr, he->h_addr, he->h_length);
|
||||
if (connect(sock, (struct sockaddr*)&addr, sizeof(struct sockaddr)) < 0) {
|
||||
// no error reporting, the daemon is probably not running
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// send status request - "status" - 6B
|
||||
//
|
||||
sz = htons(6);
|
||||
// no waiting to become writeable is really needed
|
||||
if (send(sock, &sz, sizeof(sz), 0) != sizeof(sz) || send(sock, "status", 6, 0) != 6) {
|
||||
perror("send");
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// read the lines of output and put them into the info structure
|
||||
//
|
||||
if (!fill_items(sock, &apc)) break;
|
||||
|
||||
} while (0);
|
||||
|
||||
close(sock);
|
||||
|
||||
//
|
||||
// "atomically" copy the data into working set
|
||||
//
|
||||
memcpy(info.apcupsd.items, apc.items, sizeof(info.apcupsd.items));
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
// fills in the N/A strings and default host:port
|
||||
//
|
||||
void init_apcupsd(void) {
|
||||
|
||||
int i;
|
||||
for (i = 0; i < _APCUPSD_COUNT; ++i)
|
||||
memcpy(info.apcupsd.items[i], "N/A", 4); // including \0
|
||||
memcpy(info.apcupsd.host, "localhost", 10);
|
||||
info.apcupsd.port = htons(3551);
|
||||
}
|
52
src/apcupsd.h
Normal file
52
src/apcupsd.h
Normal file
@ -0,0 +1,52 @@
|
||||
/* apcupsd.h: conky module for APC UPS daemon monitoring
|
||||
*
|
||||
* Copyright (C) 2009 Jaromir Smrcek <jaromir.smrcek@zoner.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
|
||||
* USA. */
|
||||
|
||||
#ifndef APCUPSD_H_
|
||||
#define APCUPSD_H_
|
||||
|
||||
enum _apcupsd_items {
|
||||
APCUPSD_NAME,
|
||||
APCUPSD_MODEL,
|
||||
APCUPSD_UPSMODE,
|
||||
APCUPSD_CABLE,
|
||||
APCUPSD_STATUS,
|
||||
APCUPSD_LINEV,
|
||||
APCUPSD_LOAD,
|
||||
APCUPSD_CHARGE,
|
||||
APCUPSD_TIMELEFT,
|
||||
APCUPSD_TEMP,
|
||||
APCUPSD_LASTXFER,
|
||||
_APCUPSD_COUNT,
|
||||
};
|
||||
|
||||
/* type for data exchange with main thread */
|
||||
#define APCUPSD_MAXSTR 32
|
||||
typedef struct apcupsd_s {
|
||||
char items[_APCUPSD_COUNT][APCUPSD_MAXSTR+1]; /* e.g. items[APCUPSD_STATUS] */
|
||||
char host[64];
|
||||
int port;
|
||||
} APCUPSD_S, *PAPCUPSD_S;
|
||||
|
||||
/* Service routine for the conky main thread */
|
||||
void update_apcupsd(void);
|
||||
|
||||
/* fill in the default values */
|
||||
void init_apcupsd(void);
|
||||
|
||||
#endif /*APCUPSD_H_*/
|
@ -323,7 +323,7 @@ static double last_fs_update;
|
||||
unsigned long long need_mask;
|
||||
int no_buffers;
|
||||
|
||||
#define NEED(a) ((need_mask & (1 << a)) && ((info.mask & (1 << a)) == 0))
|
||||
#define NEED(a) ((need_mask & (1ULL << a)) && ((info.mask & (1ULL << a)) == 0))
|
||||
|
||||
void update_stuff(void)
|
||||
{
|
||||
@ -456,6 +456,11 @@ void update_stuff(void)
|
||||
if (NEED(INFO_DNS)) {
|
||||
update_dns_data();
|
||||
}
|
||||
#ifdef APCUPSD
|
||||
if (NEED(INFO_APCUPSD)) {
|
||||
update_apcupsd();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
int round_to_int(float f)
|
||||
|
326
src/conky.c
326
src/conky.c
@ -217,6 +217,9 @@ static void print_version(void)
|
||||
#ifdef MIXER_IS_ALSA
|
||||
" * ALSA mixer support\n"
|
||||
#endif /* MIXER_IS_ALSA */
|
||||
#ifdef APCUPSD
|
||||
" * apcupsd\n"
|
||||
#endif /* APCUPSD */
|
||||
);
|
||||
|
||||
exit(0);
|
||||
@ -561,13 +564,18 @@ static void human_readable(long long num, char *buf, int size)
|
||||
* so the point of alignment resides between number and unit. The
|
||||
* upside of this is that there is minimal padding necessary, though
|
||||
* there should be a way to make alignment take place at the decimal
|
||||
* dot (then with fixed width decimal part). * */
|
||||
* dot (then with fixed width decimal part).
|
||||
*
|
||||
* Note the repdigits below: when given a precision value, printf()
|
||||
* rounds the float to it, not just cuts off the remaining digits. So
|
||||
* e.g. 99.95 with a precision of 1 gets 100.0, which again should be
|
||||
* printed with a precision of 0. Yay. */
|
||||
|
||||
precision = 0; /* print 100-999 without decimal part */
|
||||
if (fnum < 100)
|
||||
if (fnum < 99.95)
|
||||
precision = 1; /* print 10-99 with one decimal place */
|
||||
if (fnum < 10)
|
||||
precision = 2; /* print 0-9 with two decimal place */
|
||||
if (fnum < 9.995)
|
||||
precision = 2; /* print 0-9 with two decimal places */
|
||||
|
||||
spaced_print(buf, size, format, width, precision, fnum, *suffix);
|
||||
}
|
||||
@ -714,9 +722,11 @@ static void free_text_objects(struct text_object *root)
|
||||
case OBJ_image:
|
||||
case OBJ_eval:
|
||||
case OBJ_exec:
|
||||
#ifdef X11
|
||||
case OBJ_execgauge:
|
||||
case OBJ_execbar:
|
||||
case OBJ_execgraph:
|
||||
#endif
|
||||
case OBJ_execp:
|
||||
free(data.s);
|
||||
break;
|
||||
@ -857,9 +867,11 @@ static void free_text_objects(struct text_object *root)
|
||||
#endif /* !__OpenBSD__ */
|
||||
case OBJ_execpi:
|
||||
case OBJ_execi:
|
||||
#ifdef X11
|
||||
case OBJ_execibar:
|
||||
case OBJ_execigraph:
|
||||
case OBJ_execigauge:
|
||||
#endif
|
||||
free(data.execi.cmd);
|
||||
free(data.execi.buffer);
|
||||
break;
|
||||
@ -888,7 +900,9 @@ static void free_text_objects(struct text_object *root)
|
||||
#endif
|
||||
case OBJ_entropy_avail:
|
||||
case OBJ_entropy_poolsize:
|
||||
#ifdef X11
|
||||
case OBJ_entropy_bar:
|
||||
#endif
|
||||
break;
|
||||
case OBJ_user_names:
|
||||
if (info.users.names) {
|
||||
@ -933,7 +947,9 @@ static void free_text_objects(struct text_object *root)
|
||||
case OBJ_mpd_vol:
|
||||
case OBJ_mpd_bitrate:
|
||||
case OBJ_mpd_status:
|
||||
#ifdef X11
|
||||
case OBJ_mpd_bar:
|
||||
#endif
|
||||
case OBJ_mpd_elapsed:
|
||||
case OBJ_mpd_length:
|
||||
case OBJ_mpd_track:
|
||||
@ -972,12 +988,33 @@ static void free_text_objects(struct text_object *root)
|
||||
free_text_objects(obj->sub);
|
||||
free(obj->sub);
|
||||
break;
|
||||
#ifdef APCUPSD
|
||||
case OBJ_apcupsd:
|
||||
case OBJ_apcupsd_name:
|
||||
case OBJ_apcupsd_model:
|
||||
case OBJ_apcupsd_upsmode:
|
||||
case OBJ_apcupsd_cable:
|
||||
case OBJ_apcupsd_status:
|
||||
case OBJ_apcupsd_linev:
|
||||
case OBJ_apcupsd_load:
|
||||
#ifdef X11
|
||||
case OBJ_apcupsd_loadbar:
|
||||
case OBJ_apcupsd_loadgraph:
|
||||
case OBJ_apcupsd_loadgauge:
|
||||
#endif
|
||||
case OBJ_apcupsd_charge:
|
||||
case OBJ_apcupsd_timeleft:
|
||||
case OBJ_apcupsd_temp:
|
||||
case OBJ_apcupsd_lastxfer:
|
||||
break;
|
||||
#endif /* APCUPSD */
|
||||
}
|
||||
free(obj);
|
||||
}
|
||||
#undef data
|
||||
}
|
||||
|
||||
#ifdef X11
|
||||
void scan_mixer_bar(const char *arg, int *a, int *w, int *h)
|
||||
{
|
||||
char buf1[64];
|
||||
@ -991,6 +1028,7 @@ void scan_mixer_bar(const char *arg, int *a, int *w, int *h)
|
||||
scan_bar(arg, w, h);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* strip a leading /dev/ if any, following symlinks first
|
||||
*
|
||||
@ -1025,12 +1063,12 @@ static struct text_object *construct_text_object(const char *s,
|
||||
obj->line = line;
|
||||
|
||||
#define OBJ(a, n) if (strcmp(s, #a) == 0) { \
|
||||
obj->type = OBJ_##a; need_mask |= (1 << n); {
|
||||
obj->type = OBJ_##a; need_mask |= (1ULL << n); {
|
||||
#define OBJ_IF(a, n) if (strcmp(s, #a) == 0) { \
|
||||
obj->type = OBJ_##a; need_mask |= (1 << n); \
|
||||
obj->type = OBJ_##a; need_mask |= (1ULL << n); \
|
||||
obj_be_ifblock_if(ifblock_opaque, obj); {
|
||||
#define OBJ_THREAD(a, n) if (strcmp(s, #a) == 0 && allow_threaded) { \
|
||||
obj->type = OBJ_##a; need_mask |= (1 << n); {
|
||||
obj->type = OBJ_##a; need_mask |= (1ULL << n); {
|
||||
#define END } } else
|
||||
|
||||
#ifdef X11
|
||||
@ -1184,6 +1222,7 @@ static struct text_object *construct_text_object(const char *s,
|
||||
strcpy(bat, "BAT0");
|
||||
}
|
||||
obj->data.s = strndup(bat, text_buffer_size);
|
||||
#ifdef X11
|
||||
END OBJ(battery_bar, 0)
|
||||
char bat[64];
|
||||
obj->b = 6;
|
||||
@ -1194,6 +1233,7 @@ static struct text_object *construct_text_object(const char *s,
|
||||
strcpy(bat, "BAT0");
|
||||
}
|
||||
obj->data.s = strndup(bat, text_buffer_size);
|
||||
#endif
|
||||
#endif /* !__OpenBSD__ */
|
||||
|
||||
#if defined(__linux__)
|
||||
@ -1230,7 +1270,7 @@ static struct text_object *construct_text_object(const char *s,
|
||||
/* information from sony_laptop kernel module
|
||||
* /sys/devices/platform/sony-laptop */
|
||||
END OBJ(sony_fanspeed, 0)
|
||||
END OBJ_IF(if_gw, 0)
|
||||
END OBJ_IF(if_gw, INFO_GW)
|
||||
END OBJ(ioscheduler, 0)
|
||||
if (!arg) {
|
||||
CRIT_ERR("get_ioscheduler needs an argument (e.g. hda)");
|
||||
@ -1299,8 +1339,8 @@ static struct text_object *construct_text_object(const char *s,
|
||||
END OBJ(buffers, INFO_BUFFERS)
|
||||
END OBJ(cached, INFO_BUFFERS)
|
||||
#define SCAN_CPU(__arg, __var) { \
|
||||
int __offset; \
|
||||
if (__arg && sscanf(__arg, " cpu%u %n", &__var, &__offset) == 2) \
|
||||
int __offset = 0; \
|
||||
if (__arg && sscanf(__arg, " cpu%u %n", &__var, &__offset) > 0) \
|
||||
__arg += __offset; \
|
||||
else \
|
||||
__var = 0; \
|
||||
@ -1308,6 +1348,7 @@ static struct text_object *construct_text_object(const char *s,
|
||||
END OBJ(cpu, INFO_CPU)
|
||||
SCAN_CPU(arg, obj->data.cpu_index);
|
||||
DBGP2("Adding $cpu for CPU %d", obj->data.cpu_index);
|
||||
#ifdef X11
|
||||
END OBJ(cpugauge, INFO_CPU)
|
||||
SCAN_CPU(arg, obj->data.cpu_index);
|
||||
scan_gauge(arg, &obj->a, &obj->b);
|
||||
@ -1332,12 +1373,14 @@ static struct text_object *construct_text_object(const char *s,
|
||||
obj->data.loadavg[0] = (r >= 1) ? (unsigned char) a : 0;
|
||||
free(buf);
|
||||
}
|
||||
#endif
|
||||
END OBJ(diskio, INFO_DISKIO)
|
||||
obj->data.diskio = prepare_diskio_stat(dev_name(arg));
|
||||
END OBJ(diskio_read, INFO_DISKIO)
|
||||
obj->data.diskio = prepare_diskio_stat(dev_name(arg));
|
||||
END OBJ(diskio_write, INFO_DISKIO)
|
||||
obj->data.diskio = prepare_diskio_stat(dev_name(arg));
|
||||
#ifdef X11
|
||||
END OBJ(diskiograph, INFO_DISKIO)
|
||||
char *buf = scan_graph(arg, &obj->a, &obj->b, &obj->c, &obj->d,
|
||||
&obj->e, &obj->showaslog);
|
||||
@ -1359,6 +1402,7 @@ static struct text_object *construct_text_object(const char *s,
|
||||
obj->data.diskio = prepare_diskio_stat(dev_name(buf));
|
||||
if (buf)
|
||||
free(buf);
|
||||
#endif
|
||||
END OBJ(color, 0)
|
||||
#ifdef X11
|
||||
if (output_methods & TO_X) {
|
||||
@ -1385,8 +1429,10 @@ static struct text_object *construct_text_object(const char *s,
|
||||
obj->data.l = color8;
|
||||
END OBJ(color9, 0)
|
||||
obj->data.l = color9;
|
||||
#ifdef X11
|
||||
END OBJ(font, 0)
|
||||
obj->data.s = scan_font(arg);
|
||||
#endif
|
||||
END OBJ(conky_version, 0)
|
||||
END OBJ(conky_build_date, 0)
|
||||
END OBJ(conky_build_arch, 0)
|
||||
@ -1402,6 +1448,7 @@ static struct text_object *construct_text_object(const char *s,
|
||||
} else {
|
||||
CRIT_ERR("downspeedf needs argument");
|
||||
}
|
||||
#ifdef X11
|
||||
END OBJ(downspeedgraph, INFO_NET)
|
||||
char *buf = scan_graph(arg, &obj->a, &obj->b, &obj->c, &obj->d,
|
||||
&obj->e, &obj->showaslog);
|
||||
@ -1410,6 +1457,7 @@ static struct text_object *construct_text_object(const char *s,
|
||||
buf = strndup(buf ? buf : "DEFAULTNETDEV", text_buffer_size);
|
||||
obj->data.net = get_net_stat(buf);
|
||||
free(buf);
|
||||
#endif
|
||||
END OBJ(else, 0)
|
||||
obj_be_ifblock_else(ifblock_opaque, obj);
|
||||
END OBJ(endif, 0)
|
||||
@ -1427,6 +1475,7 @@ static struct text_object *construct_text_object(const char *s,
|
||||
obj->a = default_##arg##_width; \
|
||||
obj->b = default_##arg##_height; \
|
||||
}
|
||||
#ifdef X11
|
||||
END OBJ(execgauge, 0)
|
||||
SIZE_DEFAULTS(gauge);
|
||||
obj->data.s = strndup(arg ? arg : "", text_buffer_size);
|
||||
@ -1478,6 +1527,7 @@ static struct text_object *construct_text_object(const char *s,
|
||||
} else {
|
||||
obj->data.execi.cmd = strndup(arg + n, text_buffer_size);
|
||||
}
|
||||
#endif
|
||||
END OBJ(execi, 0)
|
||||
int n;
|
||||
|
||||
@ -1532,6 +1582,7 @@ static struct text_object *construct_text_object(const char *s,
|
||||
obj->data.s = strndup("", text_buffer_size);
|
||||
}
|
||||
#endif
|
||||
#ifdef X11
|
||||
END OBJ(fs_bar, INFO_FS)
|
||||
arg = scan_bar(arg, &obj->data.fsbar.w, &obj->data.fsbar.h);
|
||||
if (arg) {
|
||||
@ -1559,6 +1610,7 @@ static struct text_object *construct_text_object(const char *s,
|
||||
}
|
||||
|
||||
obj->data.fsbar.fs = prepare_fs_stat(arg);
|
||||
#endif
|
||||
END OBJ(fs_free, INFO_FS)
|
||||
if (!arg) {
|
||||
arg = "/";
|
||||
@ -1672,7 +1724,8 @@ static struct text_object *construct_text_object(const char *s,
|
||||
|
||||
END OBJ(hwmon, INFO_SYSFS)
|
||||
char buf1[64], buf2[64];
|
||||
int n;
|
||||
float factor, offset;
|
||||
int n, found = 0;
|
||||
|
||||
if (!arg) {
|
||||
ERR("hwmon needs argumanets");
|
||||
@ -1680,18 +1733,31 @@ static struct text_object *construct_text_object(const char *s,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (sscanf(arg, "%63s %63s %d", buf1, buf2, &n) != 3) {
|
||||
/* if scanf couldn't read three values, read type and num and use
|
||||
* default device */
|
||||
sscanf(arg, "%63s %d", buf2, &n);
|
||||
obj->data.sysfs.fd = open_hwmon_sensor(0, buf2, n,
|
||||
&obj->data.sysfs.arg, obj->data.sysfs.devtype);
|
||||
strncpy(obj->data.sysfs.type, buf2, 63);
|
||||
} else {
|
||||
obj->data.sysfs.fd = open_hwmon_sensor(buf1, buf2, n,
|
||||
&obj->data.sysfs.arg, obj->data.sysfs.devtype);
|
||||
strncpy(obj->data.sysfs.type, buf2, 63);
|
||||
buf1[0] = 0;
|
||||
factor = 1.0;
|
||||
offset = 0.0;
|
||||
|
||||
if (sscanf(arg, "%63s %63s %d %f %f", buf1, buf2, &n, &factor, &offset) == 5)
|
||||
found = 1;
|
||||
if (!found && (sscanf(arg, "%63s %d %f %f", buf2, &n, &factor, &offset) == 3))
|
||||
found = 1;
|
||||
if (!found && (sscanf(arg, "%63s %63s %d", buf1, buf2, &n) == 3))
|
||||
found = 1;
|
||||
if (!found && (sscanf(arg, "%63s %d", buf2, &n) == 2))
|
||||
found = 1;
|
||||
|
||||
if (!found) {
|
||||
ERR("hwmon failed to parse arguments");
|
||||
obj->type = OBJ_text;
|
||||
return NULL;
|
||||
}
|
||||
DBGP("parsed hwmon args: %s %s %d %f %f\n", buf1, buf2, n, factor, offset);
|
||||
obj->data.sysfs.fd = open_hwmon_sensor((*buf1) ? buf1 : 0, buf2, n,
|
||||
&obj->data.sysfs.arg, obj->data.sysfs.devtype);
|
||||
strncpy(obj->data.sysfs.type, buf2, 63);
|
||||
obj->data.sysfs.factor = factor;
|
||||
obj->data.sysfs.offset = offset;
|
||||
|
||||
#endif /* !__OpenBSD__ */
|
||||
|
||||
END
|
||||
@ -2084,6 +2150,7 @@ static struct text_object *construct_text_object(const char *s,
|
||||
END OBJ(memfree, INFO_MEM)
|
||||
END OBJ(memmax, INFO_MEM)
|
||||
END OBJ(memperc, INFO_MEM)
|
||||
#ifdef X11
|
||||
END OBJ(memgauge, INFO_MEM)
|
||||
scan_gauge(arg, &obj->data.pair.a, &obj->data.pair.b);
|
||||
END OBJ(membar, INFO_MEM)
|
||||
@ -2095,12 +2162,14 @@ static struct text_object *construct_text_object(const char *s,
|
||||
if (buf) {
|
||||
free(buf);
|
||||
}
|
||||
#endif
|
||||
END OBJ(mixer, INFO_MIXER)
|
||||
obj->data.l = mixer_init(arg);
|
||||
END OBJ(mixerl, INFO_MIXER)
|
||||
obj->data.l = mixer_init(arg);
|
||||
END OBJ(mixerr, INFO_MIXER)
|
||||
obj->data.l = mixer_init(arg);
|
||||
#ifdef X11
|
||||
END OBJ(mixerbar, INFO_MIXER)
|
||||
scan_mixer_bar(arg, &obj->data.mixerbar.l, &obj->data.mixerbar.w,
|
||||
&obj->data.mixerbar.h);
|
||||
@ -2110,6 +2179,7 @@ static struct text_object *construct_text_object(const char *s,
|
||||
END OBJ(mixerrbar, INFO_MIXER)
|
||||
scan_mixer_bar(arg, &obj->data.mixerbar.l, &obj->data.mixerbar.w,
|
||||
&obj->data.mixerbar.h);
|
||||
#endif
|
||||
END OBJ_IF(if_mixer_mute, INFO_MIXER)
|
||||
obj->data.ifblock.i = mixer_init(arg);
|
||||
#ifdef X11
|
||||
@ -2145,8 +2215,10 @@ static struct text_object *construct_text_object(const char *s,
|
||||
END OBJ(swap, INFO_MEM)
|
||||
END OBJ(swapmax, INFO_MEM)
|
||||
END OBJ(swapperc, INFO_MEM)
|
||||
#ifdef X11
|
||||
END OBJ(swapbar, INFO_MEM)
|
||||
scan_bar(arg, &obj->data.pair.a, &obj->data.pair.b);
|
||||
#endif
|
||||
END OBJ(sysname, 0)
|
||||
END OBJ(time, 0)
|
||||
obj->data.s = strndup(arg ? arg : "%F %T", text_buffer_size);
|
||||
@ -2234,6 +2306,7 @@ static struct text_object *construct_text_object(const char *s,
|
||||
CRIT_ERR("upspeedf needs argument");
|
||||
}
|
||||
|
||||
#ifdef X11
|
||||
END OBJ(upspeedgraph, INFO_NET)
|
||||
char *buf = scan_graph(arg, &obj->a, &obj->b, &obj->c, &obj->d,
|
||||
&obj->e, &obj->showaslog);
|
||||
@ -2242,6 +2315,7 @@ static struct text_object *construct_text_object(const char *s,
|
||||
buf = strndup(buf ? buf : "DEFAULTNETDEV", text_buffer_size);
|
||||
obj->data.net = get_net_stat(buf);
|
||||
free(buf);
|
||||
#endif
|
||||
END OBJ(uptime_short, INFO_UPTIME)
|
||||
END OBJ(uptime, INFO_UPTIME)
|
||||
END OBJ(user_names, INFO_USERS)
|
||||
@ -2251,7 +2325,6 @@ static struct text_object *construct_text_object(const char *s,
|
||||
#if defined(__linux__)
|
||||
END OBJ(gw_iface, INFO_GW)
|
||||
END OBJ(gw_ip, INFO_GW)
|
||||
END OBJ(if_gw, INFO_GW)
|
||||
#endif /* !__linux__ */
|
||||
#ifndef __OpenBSD__
|
||||
END OBJ(adt746xcpu, 0)
|
||||
@ -2371,9 +2444,11 @@ static struct text_object *construct_text_object(const char *s,
|
||||
END OBJ(mpd_vol, INFO_MPD) init_mpd();
|
||||
END OBJ(mpd_bitrate, INFO_MPD) init_mpd();
|
||||
END OBJ(mpd_status, INFO_MPD) init_mpd();
|
||||
#ifdef X11
|
||||
END OBJ(mpd_bar, INFO_MPD)
|
||||
scan_bar(arg, &obj->data.pair.a, &obj->data.pair.b);
|
||||
init_mpd();
|
||||
#endif
|
||||
END OBJ(mpd_smart, INFO_MPD)
|
||||
mpd_set_maxlen(mpd_smart);
|
||||
init_mpd();
|
||||
@ -2512,9 +2587,11 @@ static struct text_object *construct_text_object(const char *s,
|
||||
tcp_portmon_init(arg, &obj->data.tcp_port_monitor);
|
||||
#endif
|
||||
END OBJ(entropy_avail, INFO_ENTROPY)
|
||||
END OBJ(entropy_poolsize, INFO_ENTROPY)
|
||||
END OBJ(entropy_bar, INFO_ENTROPY)
|
||||
END OBJ(entropy_poolsize, INFO_ENTROPY)
|
||||
#ifdef X11
|
||||
END OBJ(entropy_bar, INFO_ENTROPY)
|
||||
scan_bar(arg, &obj->a, &obj->b);
|
||||
#endif
|
||||
END OBJ(scroll, 0)
|
||||
int n1, n2;
|
||||
|
||||
@ -2581,6 +2658,42 @@ static struct text_object *construct_text_object(const char *s,
|
||||
" specified: '%s'\n", arg);
|
||||
}
|
||||
#endif /* NVIDIA */
|
||||
#ifdef APCUPSD
|
||||
init_apcupsd();
|
||||
END OBJ(apcupsd, INFO_APCUPSD)
|
||||
if (arg) {
|
||||
char host[64];
|
||||
int port;
|
||||
if (sscanf(arg, "%63s %d", host, &port) != 2) {
|
||||
CRIT_ERR("apcupsd needs arguments: <host> <port>");
|
||||
} else {
|
||||
info.apcupsd.port = htons(port);
|
||||
strncpy(info.apcupsd.host, host, sizeof(info.apcupsd.host));
|
||||
}
|
||||
} else {
|
||||
CRIT_ERR("apcupsd needs arguments: <host> <port>");
|
||||
}
|
||||
END OBJ(apcupsd_name, INFO_APCUPSD)
|
||||
END OBJ(apcupsd_model, INFO_APCUPSD)
|
||||
END OBJ(apcupsd_upsmode, INFO_APCUPSD)
|
||||
END OBJ(apcupsd_cable, INFO_APCUPSD)
|
||||
END OBJ(apcupsd_status, INFO_APCUPSD)
|
||||
END OBJ(apcupsd_linev, INFO_APCUPSD)
|
||||
END OBJ(apcupsd_load, INFO_APCUPSD)
|
||||
#ifdef X11
|
||||
END OBJ(apcupsd_loadbar, INFO_APCUPSD)
|
||||
scan_bar(arg, &obj->a, &obj->b);
|
||||
END OBJ(apcupsd_loadgraph, INFO_APCUPSD)
|
||||
char* buf = scan_graph(arg, &obj->a, &obj->b, &obj->c, &obj->d, &obj->e, &obj->showaslog);
|
||||
if (buf) free(buf);
|
||||
END OBJ(apcupsd_loadgauge, INFO_APCUPSD)
|
||||
scan_gauge(arg, &obj->a, &obj->b);
|
||||
#endif
|
||||
END OBJ(apcupsd_charge, INFO_APCUPSD)
|
||||
END OBJ(apcupsd_timeleft, INFO_APCUPSD)
|
||||
END OBJ(apcupsd_temp, INFO_APCUPSD)
|
||||
END OBJ(apcupsd_lastxfer, INFO_APCUPSD)
|
||||
#endif /* APCUPSD */
|
||||
END {
|
||||
char buf[256];
|
||||
|
||||
@ -2598,12 +2711,6 @@ static struct text_object *create_plain_text(const char *s)
|
||||
{
|
||||
struct text_object *obj;
|
||||
|
||||
char *esc = strstr(s, "\\#");
|
||||
if (esc) {
|
||||
/* remove extra '\' */
|
||||
strcpy(esc, esc + 1);
|
||||
}
|
||||
|
||||
if (s == NULL || *s == '\0') {
|
||||
return NULL;
|
||||
}
|
||||
@ -2825,12 +2932,6 @@ static int extract_variable_text_internal(struct text_object *retval, const char
|
||||
if (*p == '\n') {
|
||||
line++;
|
||||
}
|
||||
/* handle comments within the TEXT area */
|
||||
if (*p == '#' && (p == orig_p || *(p - 1) != '\\')) {
|
||||
while (*p && *p != '\n') p++;
|
||||
s = p;
|
||||
line++;
|
||||
}
|
||||
if (*p == '$') {
|
||||
*p = '\0';
|
||||
obj = create_plain_text(s);
|
||||
@ -3266,9 +3367,11 @@ static void generate_text_internal(char *p, int p_max_size,
|
||||
OBJ(battery_percent) {
|
||||
percent_print(p, p_max_size, get_battery_perct(obj->data.s));
|
||||
}
|
||||
#ifdef X11
|
||||
OBJ(battery_bar) {
|
||||
new_bar(p, obj->a, obj->b, get_battery_perct_bar(obj->data.s));
|
||||
}
|
||||
#endif
|
||||
OBJ(battery_short) {
|
||||
get_battery_short_status(p, p_max_size, obj->data.s);
|
||||
}
|
||||
@ -3289,6 +3392,7 @@ static void generate_text_internal(char *p, int p_max_size,
|
||||
percent_print(p, p_max_size,
|
||||
round_to_int(cur->cpu_usage[obj->data.cpu_index] * 100.0));
|
||||
}
|
||||
#ifdef X11
|
||||
OBJ(cpugauge)
|
||||
new_gauge(p, obj->a, obj->b,
|
||||
round_to_int(cur->cpu_usage[obj->data.cpu_index] * 255.0));
|
||||
@ -3338,6 +3442,7 @@ static void generate_text_internal(char *p, int p_max_size,
|
||||
OBJ(color9) {
|
||||
new_fg(p, color9);
|
||||
}
|
||||
#endif
|
||||
OBJ(conky_version) {
|
||||
snprintf(p, p_max_size, "%s", VERSION);
|
||||
}
|
||||
@ -3492,10 +3597,11 @@ static void generate_text_internal(char *p, int p_max_size,
|
||||
get_obsd_product(p, p_max_size);
|
||||
}
|
||||
#endif /* __OpenBSD__ */
|
||||
|
||||
#ifdef X11
|
||||
OBJ(font) {
|
||||
new_font(p, obj->data.s);
|
||||
}
|
||||
#endif
|
||||
/* TODO: move this correction from kB to kB/s elsewhere
|
||||
* (or get rid of it??) */
|
||||
OBJ(diskio) {
|
||||
@ -3510,6 +3616,7 @@ static void generate_text_internal(char *p, int p_max_size,
|
||||
human_readable((obj->data.diskio->current_read / update_interval) * 1024LL,
|
||||
p, p_max_size);
|
||||
}
|
||||
#ifdef X11
|
||||
OBJ(diskiograph) {
|
||||
new_graph(p, obj->a, obj->b, obj->c, obj->d,
|
||||
obj->data.diskio->current, obj->e, 1, obj->showaslog);
|
||||
@ -3522,6 +3629,7 @@ static void generate_text_internal(char *p, int p_max_size,
|
||||
new_graph(p, obj->a, obj->b, obj->c, obj->d,
|
||||
obj->data.diskio->current_write, obj->e, 1, obj->showaslog);
|
||||
}
|
||||
#endif
|
||||
OBJ(downspeed) {
|
||||
human_readable(obj->data.net->recv_speed, p, 255);
|
||||
}
|
||||
@ -3529,10 +3637,12 @@ static void generate_text_internal(char *p, int p_max_size,
|
||||
spaced_print(p, p_max_size, "%.1f", 8,
|
||||
obj->data.net->recv_speed / 1024.0);
|
||||
}
|
||||
#ifdef X11
|
||||
OBJ(downspeedgraph) {
|
||||
new_graph(p, obj->a, obj->b, obj->c, obj->d,
|
||||
obj->data.net->recv_speed / 1024.0, obj->e, 1, obj->showaslog);
|
||||
new_graph(p, obj->a, obj->b, obj->c, obj->d,
|
||||
obj->data.net->recv_speed / 1024.0, obj->e, 1, obj->showaslog);
|
||||
}
|
||||
#endif
|
||||
OBJ(else) {
|
||||
/* Since we see you, you're if has not jumped.
|
||||
* Do Ninja jump here: without leaving traces.
|
||||
@ -3608,6 +3718,7 @@ static void generate_text_internal(char *p, int p_max_size,
|
||||
free_text_objects(&subroot);
|
||||
free(tmp_info);
|
||||
}
|
||||
#ifdef X11
|
||||
OBJ(execgauge) {
|
||||
double barnum;
|
||||
|
||||
@ -3694,6 +3805,7 @@ static void generate_text_internal(char *p, int p_max_size,
|
||||
}
|
||||
new_gauge(p, obj->a, obj->b, round_to_int(obj->f));
|
||||
}
|
||||
#endif
|
||||
OBJ(execi) {
|
||||
if (current_update_time - obj->data.execi.last_update
|
||||
>= obj->data.execi.interval
|
||||
@ -3789,6 +3901,7 @@ static void generate_text_internal(char *p, int p_max_size,
|
||||
timed_thread_unlock(mail->p_timed_thread);
|
||||
}
|
||||
}
|
||||
#ifdef X11
|
||||
OBJ(fs_bar) {
|
||||
if (obj->data.fs != NULL) {
|
||||
if (obj->data.fs->size == 0) {
|
||||
@ -3800,6 +3913,7 @@ static void generate_text_internal(char *p, int p_max_size,
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
OBJ(fs_free) {
|
||||
if (obj->data.fs != NULL) {
|
||||
human_readable( (obj->data.fs->free ? obj->data.fs->free :
|
||||
@ -3834,6 +3948,7 @@ static void generate_text_internal(char *p, int p_max_size,
|
||||
? obj->data.fs->free : obj->data.fs->avail), p, 255);
|
||||
}
|
||||
}
|
||||
#ifdef X11
|
||||
OBJ(fs_bar_free) {
|
||||
if (obj->data.fs != NULL) {
|
||||
if (obj->data.fs->size == 0) {
|
||||
@ -3845,6 +3960,7 @@ static void generate_text_internal(char *p, int p_max_size,
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
OBJ(fs_used_perc) {
|
||||
if (obj->data.fs != NULL) {
|
||||
int val = 0;
|
||||
@ -3881,9 +3997,11 @@ static void generate_text_internal(char *p, int p_max_size,
|
||||
OBJ(tab) {
|
||||
new_tab(p, obj->data.pair.a, obj->data.pair.b);
|
||||
}
|
||||
#ifdef X11
|
||||
OBJ(hr) {
|
||||
new_hr(p, obj->data.i);
|
||||
}
|
||||
#endif
|
||||
OBJ(nameserver) {
|
||||
if (cur->nameserver_info.nscount > obj->data.i)
|
||||
snprintf(p, p_max_size, "%s",
|
||||
@ -4011,6 +4129,8 @@ static void generate_text_internal(char *p, int p_max_size,
|
||||
r = get_sysfs_info(&obj->data.sysfs.fd, obj->data.sysfs.arg,
|
||||
obj->data.sysfs.devtype, obj->data.sysfs.type);
|
||||
|
||||
r = r * obj->data.sysfs.factor + obj->data.sysfs.offset;
|
||||
|
||||
if (!strncmp(obj->data.sysfs.type, "temp", 4)) {
|
||||
temp_print(p, p_max_size, r, TEMP_CELSIUS);
|
||||
} else if (r >= 100.0 || r == 0) {
|
||||
@ -4137,6 +4257,7 @@ static void generate_text_internal(char *p, int p_max_size,
|
||||
if (cur->memmax)
|
||||
percent_print(p, p_max_size, cur->mem * 100 / cur->memmax);
|
||||
}
|
||||
#ifdef X11
|
||||
OBJ(memgauge){
|
||||
new_gauge(p, obj->data.pair.a, obj->data.pair.b,
|
||||
cur->memmax ? (cur->mem * 255) / (cur->memmax) : 0);
|
||||
@ -4150,7 +4271,7 @@ static void generate_text_internal(char *p, int p_max_size,
|
||||
cur->memmax ? (cur->mem * 100.0) / (cur->memmax) : 0.0,
|
||||
100, 1, obj->showaslog);
|
||||
}
|
||||
|
||||
#endif
|
||||
/* mixer stuff */
|
||||
OBJ(mixer) {
|
||||
percent_print(p, p_max_size, mixer_get_avg(obj->data.l));
|
||||
@ -4161,6 +4282,7 @@ static void generate_text_internal(char *p, int p_max_size,
|
||||
OBJ(mixerr) {
|
||||
percent_print(p, p_max_size, mixer_get_right(obj->data.l));
|
||||
}
|
||||
#ifdef X11
|
||||
OBJ(mixerbar) {
|
||||
new_bar(p, obj->data.mixerbar.w, obj->data.mixerbar.h,
|
||||
mixer_to_255(obj->data.mixerbar.l,mixer_get_avg(obj->data.mixerbar.l)));
|
||||
@ -4173,6 +4295,7 @@ static void generate_text_internal(char *p, int p_max_size,
|
||||
new_bar(p, obj->data.mixerbar.w, obj->data.mixerbar.h,
|
||||
mixer_to_255(obj->data.mixerbar.l,mixer_get_right(obj->data.mixerbar.l)));
|
||||
}
|
||||
#endif
|
||||
OBJ(if_mixer_mute) {
|
||||
if (!mixer_is_mute(obj->data.ifblock.i)) {
|
||||
DO_JUMP;
|
||||
@ -4267,12 +4390,14 @@ static void generate_text_internal(char *p, int p_max_size,
|
||||
OBJ(text) {
|
||||
snprintf(p, p_max_size, "%s", obj->data.s);
|
||||
}
|
||||
#ifdef X11
|
||||
OBJ(shadecolor) {
|
||||
new_bg(p, obj->data.l);
|
||||
}
|
||||
OBJ(stippled_hr) {
|
||||
new_stippled_hr(p, obj->data.pair.a, obj->data.pair.b);
|
||||
}
|
||||
#endif
|
||||
OBJ(swap) {
|
||||
human_readable(cur->swap * 1024, p, 255);
|
||||
}
|
||||
@ -4286,10 +4411,12 @@ static void generate_text_internal(char *p, int p_max_size,
|
||||
percent_print(p, p_max_size, cur->swap * 100 / cur->swapmax);
|
||||
}
|
||||
}
|
||||
#ifdef X11
|
||||
OBJ(swapbar) {
|
||||
new_bar(p, obj->data.pair.a, obj->data.pair.b,
|
||||
cur->swapmax ? (cur->swap * 255) / (cur->swapmax) : 0);
|
||||
}
|
||||
#endif
|
||||
OBJ(sysname) {
|
||||
snprintf(p, p_max_size, "%s", cur->uname_s.sysname);
|
||||
}
|
||||
@ -4350,10 +4477,12 @@ static void generate_text_internal(char *p, int p_max_size,
|
||||
spaced_print(p, p_max_size, "%.1f", 8,
|
||||
obj->data.net->trans_speed / 1024.0);
|
||||
}
|
||||
#ifdef X11
|
||||
OBJ(upspeedgraph) {
|
||||
new_graph(p, obj->a, obj->b, obj->c, obj->d,
|
||||
obj->data.net->trans_speed / 1024.0, obj->e, 1, obj->showaslog);
|
||||
}
|
||||
#endif
|
||||
OBJ(uptime_short) {
|
||||
format_seconds_short(p, p_max_size, (int) cur->uptime);
|
||||
}
|
||||
@ -4437,10 +4566,12 @@ static void generate_text_internal(char *p, int p_max_size,
|
||||
OBJ(mpd_percent) {
|
||||
percent_print(p, p_max_size, (int)(mpd_get_info()->progress * 100));
|
||||
}
|
||||
#ifdef X11
|
||||
OBJ(mpd_bar) {
|
||||
new_bar(p, obj->data.pair.a, obj->data.pair.b,
|
||||
(int) (mpd_get_info()->progress * 255.0f));
|
||||
}
|
||||
#endif
|
||||
OBJ(mpd_smart) {
|
||||
struct mpd_s *mpd = mpd_get_info();
|
||||
int len = obj->data.i;
|
||||
@ -4799,6 +4930,7 @@ static void generate_text_internal(char *p, int p_max_size,
|
||||
OBJ(entropy_poolsize) {
|
||||
snprintf(p, p_max_size, "%d", cur->entropy.poolsize);
|
||||
}
|
||||
#ifdef X11
|
||||
OBJ(entropy_bar) {
|
||||
double entropy_perc;
|
||||
|
||||
@ -4806,6 +4938,7 @@ static void generate_text_internal(char *p, int p_max_size,
|
||||
(double) cur->entropy.poolsize;
|
||||
new_bar(p, obj->a, obj->b, (int) (entropy_perc * 255.0f));
|
||||
}
|
||||
#endif
|
||||
#ifdef IBM
|
||||
OBJ(smapi) {
|
||||
char *s;
|
||||
@ -4976,7 +5109,74 @@ static void generate_text_internal(char *p, int p_max_size,
|
||||
snprintf(p, p_max_size, "%d", value);
|
||||
}
|
||||
#endif /* NVIDIA */
|
||||
|
||||
#ifdef APCUPSD
|
||||
OBJ(apcupsd) {
|
||||
/* This is just a meta-object to set host:port */
|
||||
}
|
||||
OBJ(apcupsd_name) {
|
||||
snprintf(p, p_max_size, "%s",
|
||||
cur->apcupsd.items[APCUPSD_NAME]);
|
||||
}
|
||||
OBJ(apcupsd_model) {
|
||||
snprintf(p, p_max_size, "%s",
|
||||
cur->apcupsd.items[APCUPSD_MODEL]);
|
||||
}
|
||||
OBJ(apcupsd_upsmode) {
|
||||
snprintf(p, p_max_size, "%s",
|
||||
cur->apcupsd.items[APCUPSD_UPSMODE]);
|
||||
}
|
||||
OBJ(apcupsd_cable) {
|
||||
snprintf(p, p_max_size, "%s",
|
||||
cur->apcupsd.items[APCUPSD_CABLE]);
|
||||
}
|
||||
OBJ(apcupsd_status) {
|
||||
snprintf(p, p_max_size, "%s",
|
||||
cur->apcupsd.items[APCUPSD_STATUS]);
|
||||
}
|
||||
OBJ(apcupsd_linev) {
|
||||
snprintf(p, p_max_size, "%s",
|
||||
cur->apcupsd.items[APCUPSD_LINEV]);
|
||||
}
|
||||
OBJ(apcupsd_load) {
|
||||
snprintf(p, p_max_size, "%s",
|
||||
cur->apcupsd.items[APCUPSD_LOAD]);
|
||||
}
|
||||
#ifdef X11
|
||||
OBJ(apcupsd_loadbar) {
|
||||
double progress;
|
||||
progress = atof(cur->apcupsd.items[APCUPSD_LOAD]) / 100.0 * 255.0;
|
||||
new_bar(p, obj->a, obj->b, (int)progress);
|
||||
}
|
||||
OBJ(apcupsd_loadgraph) {
|
||||
double progress;
|
||||
progress = atof(cur->apcupsd.items[APCUPSD_LOAD]);
|
||||
new_graph(p, obj->a, obj->b, obj->c, obj->d,
|
||||
(int)progress, 100, 1, obj->showaslog);
|
||||
}
|
||||
OBJ(apcupsd_loadgauge) {
|
||||
double progress;
|
||||
progress = atof(cur->apcupsd.items[APCUPSD_LOAD]) / 100.0 * 255.0;
|
||||
new_gauge(p, obj->a, obj->b,
|
||||
(int)progress);
|
||||
}
|
||||
#endif
|
||||
OBJ(apcupsd_charge) {
|
||||
snprintf(p, p_max_size, "%s",
|
||||
cur->apcupsd.items[APCUPSD_CHARGE]);
|
||||
}
|
||||
OBJ(apcupsd_timeleft) {
|
||||
snprintf(p, p_max_size, "%s",
|
||||
cur->apcupsd.items[APCUPSD_TIMELEFT]);
|
||||
}
|
||||
OBJ(apcupsd_temp) {
|
||||
snprintf(p, p_max_size, "%s",
|
||||
cur->apcupsd.items[APCUPSD_TEMP]);
|
||||
}
|
||||
OBJ(apcupsd_lastxfer) {
|
||||
snprintf(p, p_max_size, "%s",
|
||||
cur->apcupsd.items[APCUPSD_LASTXFER]);
|
||||
}
|
||||
#endif /* APCUPSD */
|
||||
break;
|
||||
}
|
||||
#undef DO_JUMP
|
||||
@ -6691,6 +6891,29 @@ static FILE *open_config_file(const char *f)
|
||||
return fopen(f, "r");
|
||||
}
|
||||
|
||||
void 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;
|
||||
}
|
||||
*(curplace2 - 1) = 0;
|
||||
} else if(*curplace == '#' && !newend) {
|
||||
newend = curplace;
|
||||
} else if(*curplace == '\n' && newend) {
|
||||
*newend = '\n';
|
||||
newend++;
|
||||
}
|
||||
}
|
||||
if(newend) {
|
||||
*newend = 0;
|
||||
}
|
||||
}
|
||||
|
||||
static int do_config_step(int *line, FILE *fp, char *buf, char **name, char **value)
|
||||
{
|
||||
char *p, *p2;
|
||||
@ -6698,15 +6921,10 @@ static int do_config_step(int *line, FILE *fp, char *buf, char **name, char **va
|
||||
if (fgets(buf, CONF_BUFF_SIZE, fp) == NULL) {
|
||||
return CONF_BREAK;
|
||||
}
|
||||
remove_comments(buf);
|
||||
|
||||
p = buf;
|
||||
|
||||
/* break at comment, unless preceeded by \ */
|
||||
p2 = strchr(p, '#');
|
||||
if (p2 && (p2 == p || *(p2 - 1) != '\\')) {
|
||||
*p2 = '\0';
|
||||
}
|
||||
|
||||
/* skip spaces */
|
||||
while (*p && isspace((int) *p)) {
|
||||
p++;
|
||||
@ -6867,6 +7085,7 @@ static void load_config_file(const char *f)
|
||||
CONF_ERR;
|
||||
}
|
||||
}
|
||||
#ifdef X11
|
||||
CONF("default_bar_size") {
|
||||
char err = 0;
|
||||
if (value) {
|
||||
@ -6906,6 +7125,7 @@ static void load_config_file(const char *f)
|
||||
CONF_ERR2("default_gauge_size takes 2 integer arguments (ie. 'default_gauge_size 0 6')")
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#ifdef MPD
|
||||
CONF("mpd_host") {
|
||||
if (value) {
|
||||
@ -7263,14 +7483,6 @@ static void load_config_file(const char *f)
|
||||
}
|
||||
}
|
||||
#endif /* X11 */
|
||||
CONF("temp1") {
|
||||
ERR("temp1 configuration is obsolete, use ${i2c <i2c device here> "
|
||||
"temp 1}");
|
||||
}
|
||||
CONF("temp2") {
|
||||
ERR("temp2 configuration is obsolete, use ${i2c <i2c device here> "
|
||||
"temp 2}");
|
||||
}
|
||||
CONF("update_interval") {
|
||||
if (value) {
|
||||
update_interval = strtod(value, 0);
|
||||
@ -7334,6 +7546,7 @@ static void load_config_file(const char *f)
|
||||
if (fgets(buf, CONF_BUFF_SIZE, fp) == NULL) {
|
||||
break;
|
||||
}
|
||||
remove_comments(buf);
|
||||
|
||||
/* Remove \\-\n. */
|
||||
bl = strlen(buf);
|
||||
@ -7658,6 +7871,7 @@ static void print_help(const char *prog_name) {
|
||||
#ifdef X11
|
||||
" -a, --alignment=ALIGNMENT text alignment on screen, {top,bottom,middle}_{left,right,middle}\n"
|
||||
" -f, --font=FONT font to use\n"
|
||||
" -X, --display=DISPLAY X11 display to use\n"
|
||||
#ifdef OWN_WINDOW
|
||||
" -o, --own-window create own window to draw\n"
|
||||
#endif
|
||||
|
13
src/conky.h
13
src/conky.h
@ -103,6 +103,10 @@ char *strndup(const char *s, size_t n);
|
||||
#include "smapi.h"
|
||||
#endif
|
||||
|
||||
#ifdef APCUPSD
|
||||
#include "apcupsd.h"
|
||||
#endif
|
||||
|
||||
/* sony support */
|
||||
#include "sony.h"
|
||||
|
||||
@ -190,7 +194,10 @@ enum {
|
||||
#endif
|
||||
INFO_DNS = 30,
|
||||
#ifdef MOC
|
||||
INFO_MOC = 31
|
||||
INFO_MOC = 31,
|
||||
#endif
|
||||
#ifdef APCUPSD
|
||||
INFO_APCUPSD = 32,
|
||||
#endif
|
||||
};
|
||||
|
||||
@ -262,6 +269,10 @@ struct information {
|
||||
struct x11_info x11;
|
||||
#endif
|
||||
|
||||
#ifdef APCUPSD
|
||||
APCUPSD_S apcupsd;
|
||||
#endif
|
||||
|
||||
short kflags; /* kernel settings, see enum KFLAG */
|
||||
};
|
||||
|
||||
|
20
src/linux.c
20
src/linux.c
@ -825,6 +825,7 @@ int open_sysfs_sensor(const char *dir, const char *dev, const char *type, int n,
|
||||
char buf[256];
|
||||
int fd;
|
||||
int divfd;
|
||||
struct stat st;
|
||||
|
||||
memset(buf, 0, sizeof(buf));
|
||||
|
||||
@ -851,16 +852,21 @@ int open_sysfs_sensor(const char *dir, const char *dev, const char *type, int n,
|
||||
}
|
||||
}
|
||||
|
||||
/* change vol to in */
|
||||
if (strcmp(type, "vol") == 0) {
|
||||
type = "in";
|
||||
/* At least the acpitz hwmon doesn't have a 'device' subdir,
|
||||
* so check it's existence and strip it from buf otherwise. */
|
||||
snprintf(path, 255, "%s%s", dir, dev);
|
||||
if (stat(path, &st)) {
|
||||
buf[strlen(buf) - 7] = 0;
|
||||
}
|
||||
|
||||
if (strcmp(type, "tempf") == 0) {
|
||||
snprintf(path, 255, "%s%s/%s%d_input", dir, dev, "temp", n);
|
||||
} else {
|
||||
snprintf(path, 255, "%s%s/%s%d_input", dir, dev, type, n);
|
||||
/* change vol to in, tempf to temp */
|
||||
if (strcmp(type, "vol") == 0) {
|
||||
type = "in";
|
||||
} else if (strcmp(type, "tempf") == 0) {
|
||||
type = "temp";
|
||||
}
|
||||
|
||||
snprintf(path, 255, "%s%s/%s%d_input", dir, dev, type, n);
|
||||
strncpy(devtype, path, 255);
|
||||
|
||||
/* open file */
|
||||
|
@ -42,6 +42,7 @@ struct special_t *specials = NULL;
|
||||
|
||||
unsigned int special_count;
|
||||
|
||||
#ifdef X11
|
||||
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;
|
||||
@ -187,6 +188,7 @@ char *scan_graph(const char *args, int *w, int *h,
|
||||
return strndup(buf, text_buffer_size);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Printing various special text objects
|
||||
@ -204,9 +206,9 @@ static struct special_t *new_special(char *buf, enum special_types t)
|
||||
return &specials[special_count++];
|
||||
}
|
||||
|
||||
#ifdef X11
|
||||
void new_gauge(char *buf, int w, int h, int usage)
|
||||
{
|
||||
#ifdef X11
|
||||
struct special_t *s = 0;
|
||||
if ((output_methods & TO_X) == 0)
|
||||
return;
|
||||
@ -216,12 +218,10 @@ void new_gauge(char *buf, int w, int h, int usage)
|
||||
s->arg = (usage > 255) ? 255 : ((usage < 0) ? 0 : usage);
|
||||
s->width = w;
|
||||
s->height = h;
|
||||
#endif
|
||||
}
|
||||
|
||||
void new_bar(char *buf, int w, int h, int usage)
|
||||
{
|
||||
#ifdef X11
|
||||
struct special_t *s = 0;
|
||||
|
||||
if ((output_methods & TO_X) == 0)
|
||||
@ -232,12 +232,10 @@ void new_bar(char *buf, int w, int h, int usage)
|
||||
s->arg = (usage > 255) ? 255 : ((usage < 0) ? 0 : usage);
|
||||
s->width = w;
|
||||
s->height = h;
|
||||
#endif
|
||||
}
|
||||
|
||||
void new_font(char *buf, char *args)
|
||||
{
|
||||
#ifdef X11
|
||||
if ((output_methods & TO_X) == 0)
|
||||
return;
|
||||
|
||||
@ -258,11 +256,6 @@ void new_font(char *buf, char *args)
|
||||
selected_font = s->font_added = 0;
|
||||
selected_font = tmp;
|
||||
}
|
||||
#else
|
||||
(void)buf;
|
||||
(void)args;
|
||||
return;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void graph_append(struct special_t *graph, double f, char showaslog)
|
||||
@ -298,7 +291,6 @@ static void graph_append(struct special_t *graph, double f, char showaslog)
|
||||
void new_graph(char *buf, int w, int h, unsigned int first_colour,
|
||||
unsigned int second_colour, double i, int scale, int append, char showaslog)
|
||||
{
|
||||
#ifdef X11
|
||||
struct special_t *s = 0;
|
||||
|
||||
if ((output_methods & TO_X) == 0)
|
||||
@ -341,22 +333,18 @@ void new_graph(char *buf, int w, int h, unsigned int first_colour,
|
||||
if (append) {
|
||||
graph_append(s, i, showaslog);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void new_hr(char *buf, int a)
|
||||
{
|
||||
#ifdef X11
|
||||
if ((output_methods & TO_X) == 0)
|
||||
return;
|
||||
|
||||
new_special(buf, HORIZONTAL_LINE)->height = a;
|
||||
#endif
|
||||
}
|
||||
|
||||
void new_stippled_hr(char *buf, int a, int b)
|
||||
{
|
||||
#ifdef X11
|
||||
struct special_t *s = 0;
|
||||
|
||||
if ((output_methods & TO_X) == 0)
|
||||
@ -366,28 +354,24 @@ void new_stippled_hr(char *buf, int a, int b)
|
||||
|
||||
s->height = b;
|
||||
s->arg = a;
|
||||
#endif
|
||||
}
|
||||
|
||||
void new_fg(char *buf, long c)
|
||||
{
|
||||
#ifdef X11
|
||||
if ((output_methods & TO_X) == 0)
|
||||
return;
|
||||
|
||||
new_special(buf, FG)->arg = c;
|
||||
#endif
|
||||
}
|
||||
|
||||
void new_bg(char *buf, long c)
|
||||
{
|
||||
#ifdef X11
|
||||
if ((output_methods & TO_X) == 0)
|
||||
return;
|
||||
|
||||
new_special(buf, BG)->arg = c;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
void new_outline(char *buf, long c)
|
||||
{
|
||||
|
@ -76,16 +76,19 @@ 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;
|
||||
extern int default_graph_width;
|
||||
extern int default_graph_height;
|
||||
extern int default_gauge_width;
|
||||
extern int default_gauge_height;
|
||||
#endif
|
||||
|
||||
/* max number of specials allowed (TODO: use linked list instead) */
|
||||
extern unsigned int max_specials;
|
||||
|
||||
#ifdef X11
|
||||
/* scanning special arguments */
|
||||
const char *scan_gauge(const char *, int *, int *);
|
||||
const char *scan_bar(const char *, int *, int *);
|
||||
@ -101,6 +104,7 @@ void new_graph(char *, int, int, unsigned int,
|
||||
unsigned int, double, int, int, char);
|
||||
void new_hr(char *, int);
|
||||
void new_stippled_hr(char *, int, int);
|
||||
#endif
|
||||
void new_fg(char *, long);
|
||||
void new_bg(char *, long);
|
||||
void new_outline(char *, long);
|
||||
|
@ -55,7 +55,9 @@ enum text_object_type {
|
||||
OBJ_battery,
|
||||
OBJ_battery_time,
|
||||
OBJ_battery_percent,
|
||||
#ifdef X11
|
||||
OBJ_battery_bar,
|
||||
#endif
|
||||
OBJ_battery_short,
|
||||
#endif /* !__OpenBSD__ */
|
||||
OBJ_buffers,
|
||||
@ -76,19 +78,25 @@ enum text_object_type {
|
||||
OBJ_conky_build_arch,
|
||||
OBJ_font,
|
||||
OBJ_cpu,
|
||||
#ifdef X11
|
||||
OBJ_cpugauge,
|
||||
OBJ_cpubar,
|
||||
OBJ_cpugraph,
|
||||
OBJ_loadgraph,
|
||||
#endif
|
||||
OBJ_diskio,
|
||||
OBJ_diskio_read,
|
||||
OBJ_diskio_write,
|
||||
#ifdef X11
|
||||
OBJ_diskiograph,
|
||||
OBJ_diskiograph_read,
|
||||
OBJ_diskiograph_write,
|
||||
#endif
|
||||
OBJ_downspeed,
|
||||
OBJ_downspeedf,
|
||||
#ifdef X11
|
||||
OBJ_downspeedgraph,
|
||||
#endif
|
||||
OBJ_else,
|
||||
OBJ_endif,
|
||||
OBJ_eval,
|
||||
@ -96,18 +104,22 @@ enum text_object_type {
|
||||
OBJ_exec,
|
||||
OBJ_execi,
|
||||
OBJ_texeci,
|
||||
#ifdef X11
|
||||
OBJ_execgauge,
|
||||
OBJ_execbar,
|
||||
OBJ_execgraph,
|
||||
OBJ_execibar,
|
||||
OBJ_execigraph,
|
||||
OBJ_execigauge,
|
||||
#endif
|
||||
OBJ_execp,
|
||||
OBJ_execpi,
|
||||
OBJ_freq,
|
||||
OBJ_freq_g,
|
||||
#ifdef X11
|
||||
OBJ_fs_bar,
|
||||
OBJ_fs_bar_free,
|
||||
#endif
|
||||
OBJ_fs_free,
|
||||
OBJ_fs_free_perc,
|
||||
OBJ_fs_size,
|
||||
@ -142,7 +154,9 @@ enum text_object_type {
|
||||
OBJ_ibm_volume,
|
||||
OBJ_ibm_brightness,
|
||||
OBJ_smapi,
|
||||
#ifdef X11
|
||||
OBJ_smapi_bat_bar,
|
||||
#endif
|
||||
OBJ_smapi_bat_perc,
|
||||
OBJ_smapi_bat_temp,
|
||||
OBJ_smapi_bat_power,
|
||||
@ -166,7 +180,9 @@ enum text_object_type {
|
||||
OBJ_wireless_link_qual,
|
||||
OBJ_wireless_link_qual_max,
|
||||
OBJ_wireless_link_qual_perc,
|
||||
#ifdef X11
|
||||
OBJ_wireless_link_bar,
|
||||
#endif
|
||||
#endif /* __linux__ */
|
||||
#if defined(__FreeBSD__) || defined(__linux__)
|
||||
OBJ_if_up,
|
||||
@ -203,17 +219,21 @@ enum text_object_type {
|
||||
OBJ_mem,
|
||||
OBJ_memeasyfree,
|
||||
OBJ_memfree,
|
||||
#ifdef X11
|
||||
OBJ_memgauge,
|
||||
OBJ_membar,
|
||||
OBJ_memgraph,
|
||||
#endif
|
||||
OBJ_memmax,
|
||||
OBJ_memperc,
|
||||
OBJ_mixer,
|
||||
OBJ_mixerl,
|
||||
OBJ_mixerr,
|
||||
#ifdef X11
|
||||
OBJ_mixerbar,
|
||||
OBJ_mixerlbar,
|
||||
OBJ_mixerrbar,
|
||||
#endif
|
||||
OBJ_if_mixer_mute,
|
||||
#ifdef X11
|
||||
OBJ_monitor,
|
||||
@ -229,7 +249,9 @@ enum text_object_type {
|
||||
OBJ_outlinecolor,
|
||||
OBJ_stippled_hr,
|
||||
OBJ_swap,
|
||||
#ifdef X11
|
||||
OBJ_swapbar,
|
||||
#endif
|
||||
OBJ_swapmax,
|
||||
OBJ_swapperc,
|
||||
OBJ_sysname,
|
||||
@ -242,7 +264,9 @@ enum text_object_type {
|
||||
OBJ_updates,
|
||||
OBJ_upspeed,
|
||||
OBJ_upspeedf,
|
||||
#ifdef X11
|
||||
OBJ_upspeedgraph,
|
||||
#endif
|
||||
OBJ_uptime,
|
||||
OBJ_uptime_short,
|
||||
OBJ_user_names,
|
||||
@ -275,7 +299,9 @@ enum text_object_type {
|
||||
OBJ_mpd_vol,
|
||||
OBJ_mpd_bitrate,
|
||||
OBJ_mpd_status,
|
||||
#ifdef X11
|
||||
OBJ_mpd_bar,
|
||||
#endif
|
||||
OBJ_mpd_elapsed,
|
||||
OBJ_mpd_length,
|
||||
OBJ_mpd_track,
|
||||
@ -314,7 +340,9 @@ enum text_object_type {
|
||||
OBJ_xmms2_size,
|
||||
OBJ_xmms2_percent,
|
||||
OBJ_xmms2_status,
|
||||
#ifdef X11
|
||||
OBJ_xmms2_bar,
|
||||
#endif
|
||||
OBJ_xmms2_smart,
|
||||
OBJ_xmms2_playlist,
|
||||
OBJ_xmms2_timesplayed,
|
||||
@ -334,8 +362,10 @@ enum text_object_type {
|
||||
OBJ_audacious_playlist_length,
|
||||
OBJ_audacious_playlist_position,
|
||||
OBJ_audacious_main_volume,
|
||||
#ifdef X11
|
||||
OBJ_audacious_bar,
|
||||
#endif
|
||||
#endif
|
||||
#ifdef BMPX
|
||||
OBJ_bmpx_title,
|
||||
OBJ_bmpx_artist,
|
||||
@ -364,7 +394,28 @@ enum text_object_type {
|
||||
OBJ_combine,
|
||||
OBJ_entropy_avail,
|
||||
OBJ_entropy_poolsize,
|
||||
OBJ_entropy_bar
|
||||
#ifdef X11
|
||||
OBJ_entropy_bar,
|
||||
#endif
|
||||
#ifdef APCUPSD
|
||||
OBJ_apcupsd,
|
||||
OBJ_apcupsd_name,
|
||||
OBJ_apcupsd_model,
|
||||
OBJ_apcupsd_upsmode,
|
||||
OBJ_apcupsd_cable,
|
||||
OBJ_apcupsd_status,
|
||||
OBJ_apcupsd_linev,
|
||||
OBJ_apcupsd_load,
|
||||
#ifdef X11
|
||||
OBJ_apcupsd_loadbar,
|
||||
OBJ_apcupsd_loadgraph,
|
||||
OBJ_apcupsd_loadgauge,
|
||||
#endif
|
||||
OBJ_apcupsd_charge,
|
||||
OBJ_apcupsd_timeleft,
|
||||
OBJ_apcupsd_temp,
|
||||
OBJ_apcupsd_lastxfer,
|
||||
#endif
|
||||
};
|
||||
|
||||
struct text_object {
|
||||
@ -392,6 +443,7 @@ struct text_object {
|
||||
char *fmt; /* time display formatting */
|
||||
} tztime;
|
||||
|
||||
#ifdef X11
|
||||
struct {
|
||||
struct fs_stat *fs;
|
||||
int w, h;
|
||||
@ -401,13 +453,15 @@ struct text_object {
|
||||
int l;
|
||||
int w, h;
|
||||
} mixerbar; /* 3 */
|
||||
#endif
|
||||
|
||||
struct {
|
||||
int fd;
|
||||
int arg;
|
||||
char devtype[256];
|
||||
char type[64];
|
||||
} sysfs; /* 2 */
|
||||
float factor, offset;
|
||||
} sysfs;
|
||||
|
||||
struct {
|
||||
struct text_object *next;
|
||||
|
12
src/xmms2.c
12
src/xmms2.c
@ -26,8 +26,6 @@
|
||||
|
||||
#include "conky.h"
|
||||
|
||||
xmms_socket_t xmms2_fd;
|
||||
fd_set xmms2_fdset;
|
||||
xmmsc_connection_t *xmms2_conn;
|
||||
|
||||
#define CONN_INIT 0
|
||||
@ -311,17 +309,11 @@ void update_xmms2()
|
||||
|
||||
/* handle callbacks */
|
||||
if (current_info->xmms2.conn_state == CONN_OK) {
|
||||
struct timeval tmout;
|
||||
|
||||
tmout.tv_sec = 0;
|
||||
tmout.tv_usec = 100;
|
||||
|
||||
select(xmms2_fd + 1, &xmms2_fdset, NULL, NULL, &tmout);
|
||||
|
||||
xmmsc_io_in_handle(xmms2_conn);
|
||||
if (xmmsc_io_want_out(xmms2_conn)) {
|
||||
if (xmmsc_io_want_out(xmms2_conn))
|
||||
xmmsc_io_out_handle(xmms2_conn);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user