# $Id$
+2006-12-22
+ * client/server infrastructure and prototype for linux only (so far):
+ - requires libdexter (http://sourceforge.net/projects/libdexter)
+ and the dxt-sysinfo plugin (svn only at the moment).
+ * new config items:
+ - dexter_client yes/no
+ - dexter_server yes/no
+ - dexter_config /path/to/libdexter/config (default: $HOME/.dexterrc)
+ - own_window_class <WM Class Name> (default: Conky)
+ - replaces wm_class_name
+ - own_window_title <Window Title> (default: <hostname> - conky)
+ * removed config items:
+ - wm_class_name (use own_window_class, same function)
+ * configure changes:
+ --disable-network (default=yes) with auto-detection for libdexter.
+ - remove useless --enable-proc-uptime (PROC_UPTIME never referenced).
+ HAVE_SYSINFO and others determine if /proc/uptime is used.
+ - silently disable xft, double-buffer and xdamage if no x11.
+ - change enable/disable labels to reflect defaults accurately.
+ - simplified compile-based checks for sysinfo/getloadavg and by moving
+ them into AC_CHECK_FUNCS.
+ * allow decorated, own_window=yes windows to be given input focus by WM:
+ - do not pass button clicks through to desktop in this scenario as conky
+ immediately loses focus.
+
2006-12-13
* Clarify LGPL license on timed_thread modules.
* Update NEWS files.
./configure --prefix=/usr --mandir=/usr/share/man --in-
fodir=/usr/share/info --datadir=/usr/share --sysconfdir=/etc --local-
- statedir=/var/lib --enable-xft --enable-own-window --enable-proc-uptime
- --enable-audacious --enable-bmpx --enable-hddtemp --enable-mpd --en-
- able-xmms2 --enable-imlib2 --enable-portmon --enable-debug --en-
- able-double-buffer --enable-xdamage --enable-x11
+ statedir=/var/lib --disable-own-window --enable-audacious --enable-bmpx
+ --disable-hddtemp --disable-mpd --enable-xmms2 --disable-portmon --dis-
+ able-network --enable-debug --disable-x11 --disable-double-buffer
+ --disable-xdamage --disable-xft
make
Default shading color and border's shading color
+ dexter_client
+ Act as client and connect to libdexter server for remote moni-
+ toring?
+
+
+ dexter_config
+ Full path to libdexter configuration file (default search order:
+ $HOME/.dexterrc; /etc/libdexter/dexter.conf)
+
+
+ dexter_server
+ Act as server for libdexter services?
+
+
double_buffer
Use the Xdbe extension? (eliminates flicker) It is highly recom-
mended to use own window with this one so double buffer won't be
Boolean, create own window to draw?
- own_window_transparent
- Boolean, set pseudo-transparency?
-
-
- own_window_type
- if own_window is yes, you may specify type normal, desktop or
- override (default: normal). Desktop windows are special windows
- that have no window decorations; are always visible on your
- desktop; do not appear in your pager or taskbar; and are sticky
- across all workspaces. Override windows are not under the con-
- trol of the window manager. Hints are ignored. This type of win-
- dow can be useful for certain situations.
+ own_window_class
+ Manually set the WM_CLASS name. Defaults to "Conky".
own_window_colour colour
no meaning and are ignored.
+ own_window_title
+ Manually set the window name. Defaults to "<hostname> - conky".
+
+
+ own_window_transparent
+ Boolean, set pseudo-transparency?
+
+
+ own_window_type
+ if own_window is yes, you may specify type normal, desktop or
+ override (default: normal). Desktop windows are special windows
+ that have no window decorations; are always visible on your
+ desktop; do not appear in your pager or taskbar; and are sticky
+ across all workspaces. Override windows are not under the con-
+ trol of the window manager. Hints are ignored. This type of win-
+ dow can be useful for certain situations.
+
+
out_to_console
Print text to stdout.
Pad percentages to this many decimals (0 = no padding)
- pop3 Default global POP3 server. Arguments are: "host user pass [-i
- interval] [-p port] [-e command]". Default port is 110, default
- interval is 5 minutes. If the password is supplied as '*', you
+ pop3 Default global POP3 server. Arguments are: "host user pass [-i
+ interval] [-p port] [-e command]". Default port is 110, default
+ interval is 5 minutes. If the password is supplied as '*', you
will be prompted to enter the password when Conky starts.
total_run_times
- Total number of times for Conky to update before quitting. Zero
+ Total number of times for Conky to update before quitting. Zero
makes Conky run forever
Use Xft (anti-aliased font and stuff)
- wm_class_name
- Manually set the WM_CLASS name. Defaults to "conky".
-
-
xftalpha
Alpha of Xft font. Must be a value at or between 1 and 0.
VARIABLES
- Colors are parsed using XParsecolor(), there might be a list of them:
- /usr/X11R6/lib/X11/rgb.txt. Also, <http://sedition.com/perl/rgb.html>.
- Color can be also in #rrggbb format (hex). Note that when displaying
- bytes, power is 1024 and not 1000 so 1M really means 1024*1024 bytes
+ Colors are parsed using XParsecolor(), there might be a list of them:
+ /usr/X11R6/lib/X11/rgb.txt. Also, <http://sedition.com/perl/rgb.html>.
+ Color can be also in #rrggbb format (hex). Note that when displaying
+ bytes, power is 1024 and not 1000 so 1M really means 1024*1024 bytes
and not 1000*1000.
addr interface
apm_battery_time
- Display remaining APM battery life in hh:mm:ss or "unknown" if
+ Display remaining APM battery life in hh:mm:ss or "unknown" if
AC adapterstatus is on-line or charging (FreeBSD only)
battery (num)
- Battery status and remaining percentage capacity of ACPI or APM
- battery. ACPI battery number can be given as argument (default
+ Battery status and remaining percentage capacity of ACPI or APM
+ battery. ACPI battery number can be given as argument (default
is BAT0).
battery_time (num)
- Battery charge/discharge time remaining of ACPI battery. ACPI
+ Battery charge/discharge time remaining of ACPI battery. ACPI
battery number can be given as argument (default is BAT0).
cpu (cpuN)
- CPU usage in percents. For SMP machines, the CPU number can be
- provided as an argument. ${cpu 0} is the total usage, and ${cpu
+ CPU usage in percents. For SMP machines, the CPU number can be
+ provided as an argument. ${cpu 0} is the total usage, and ${cpu
X} (X >= 1) are individual CPUs.
cpubar (cpu number) (height),(width)
- Bar that shows CPU usage, height is bar's height in pixels. See
+ Bar that shows CPU usage, height is bar's height in pixels. See
$cpu for more info on SMP.
- cpugraph (cpu number) (height),(width) (gradient colour 1) (gradient
+ cpugraph (cpu number) (height),(width) (gradient colour 1) (gradient
colour 2)
- CPU usage graph, with optional colours in hex, minus the #. See
+ CPU usage graph, with optional colours in hex, minus the #. See
$cpu for more info on SMP.
diskio Displays current disk IO.
- diskiograph (height),(width) (gradient colour 1) (gradient colour 2)
+ diskiograph (height),(width) (gradient colour 1) (gradient colour 2)
(scale)
- Disk IO graph, colours defined in hex, minus the #. If scale is
+ Disk IO graph, colours defined in hex, minus the #. If scale is
non-zero, it becomes the scale for the graph.
downspeedgraph net (height),(width) (gradient colour 1) (gradient
colour 2) (scale)
- Download speed graph, colours defined in hex, minus the #. If
+ Download speed graph, colours defined in hex, minus the #. If
scale is non-zero, it becomes the scale for the graph.
exec command
Executes a shell command and displays the output in conky. warn-
- ing: this takes a lot more resources than other variables. I'd
+ ing: this takes a lot more resources than other variables. I'd
recommend coding wanted behaviour in C and posting a patch.
execbar command
- Same as exec, except if the first value return is a value be-
+ Same as exec, except if the first value return is a value be-
tween 0-100, it will use that number for a bar. The size for the
bar is currently fixed, but that may change in the future.
execi interval command
- Same as exec but with specific interval. Interval can't be less
+ Same as exec but with specific interval. Interval can't be less
than update_interval in configuration. See also $texeci
font (font)
- Specify a different font. This new font will apply to the cur-
- rent line and everything following. You can use a $font with no
- arguments to change back to the default font (much like with
+ Specify a different font. This new font will apply to the cur-
+ rent line and everything following. You can use a $font with no
+ arguments to change back to the default font (much like with
$color)
freq (n)
- Returns CPU #n's frequency in MHz. CPUs are counted from 1. If
+ Returns CPU #n's frequency in MHz. CPUs are counted from 1. If
omitted, the parameter defaults to 1.
freq_g (n)
- Returns CPU #n's frequency in GHz. CPUs are counted from 1. If
+ Returns CPU #n's frequency in GHz. CPUs are counted from 1. If
omitted, the parameter defaults to 1.
freq_dyn
- Returns CPU frequency in MHz, but is calculated by counting to
- clock cycles to complete an instruction. Only available for
+ Returns CPU frequency in MHz, but is calculated by counting to
+ clock cycles to complete an instruction. Only available for
x86/amd64.
freq_dyn_g
- Returns CPU frequency in GHz, but is calculated by counting to
- clock cycles to complete an instruction. Only available for
+ Returns CPU frequency in GHz, but is calculated by counting to
+ clock cycles to complete an instruction. Only available for
x86/amd64.
fs_bar (height),(width) fs
- Bar that shows how much space is used on a file system. height
+ Bar that shows how much space is used on a file system. height
is the height in pixels. fs is any file on that file system.
hddtemp dev, (host,(port))
- Displays temperature of a selected hard disk drive as reported
- by the hddtemp daemon running on host:port. Default host is
+ Displays temperature of a selected hard disk drive as reported
+ by the hddtemp daemon running on host:port. Default host is
127.0.0.1, default port is 7634.
head logfile lines (interval)
- Displays first N lines of supplied text text file. If interval
- is not supplied, Conky assumes 2x Conky's interval. Max of 30
+ Displays first N lines of supplied text text file. If interval
+ is not supplied, Conky assumes 2x Conky's interval. Max of 30
lines can be displayed, or until the text buffer is filled.
iconv_start codeset_from codeset_to
- Convert text from one codeset to another using GNU iconv. Needs
+ Convert text from one codeset to another using GNU iconv. Needs
to be stopped with iconv_stop.
i2c (dev) type n
- I2C sensor from sysfs (Linux 2.6). dev may be omitted if you
- have only one I2C device. type is either in (or vol) meaning
+ I2C sensor from sysfs (Linux 2.6). dev may be omitted if you
+ have only one I2C device. type is either in (or vol) meaning
voltage, fan meaning fan or temp/tempf (first in C, second in F)
- meaning temperature. n is number of the sensor. See
+ meaning temperature. n is number of the sensor. See
/sys/bus/i2c/devices/ on your local computer.
i8k_ac_status
- If running the i8k kernel driver for Inspiron laptops, displays
- whether ac power is on, as listed in /proc/i8k (translated to
- human-readable). Beware that this is by default not enabled by
+ If running the i8k kernel driver for Inspiron laptops, displays
+ whether ac power is on, as listed in /proc/i8k (translated to
+ human-readable). Beware that this is by default not enabled by
i8k itself.
i8k_bios
- If running the i8k kernel driver for Inspiron laptops, displays
+ If running the i8k kernel driver for Inspiron laptops, displays
the bios version as listed in /proc/i8k.
i8k_buttons_status
- If running the i8k kernel driver for Inspiron laptops, displays
+ If running the i8k kernel driver for Inspiron laptops, displays
the volume buttons status as listed in /proc/i8k.
i8k_cpu_temp
- If running the i8k kernel driver for Inspiron laptops, displays
+ If running the i8k kernel driver for Inspiron laptops, displays
the cpu temperature in Celsius, as reported by /proc/i8k.
i8k_cpu_tempf
- If running the i8k kernel driver for Inspiron laptops, displays
+ If running the i8k kernel driver for Inspiron laptops, displays
the cpu temperature in Fahrenheit, as reported by /proc/i8k.
i8k_left_fan_rpm
- If running the i8k kernel driver for Inspiron laptops, displays
- the left fan's rate of rotation, in revolutions per minute as
+ If running the i8k kernel driver for Inspiron laptops, displays
+ the left fan's rate of rotation, in revolutions per minute as
listed in /proc/i8k. Beware, some laptops i8k reports these fans
in reverse order.
i8k_left_fan_status
- If running the i8k kernel driver for Inspiron laptops, displays
+ If running the i8k kernel driver for Inspiron laptops, displays
the left fan status as listed in /proc/i8k (translated to human-
- readable). Beware, some laptops i8k reports these fans in re-
+ readable). Beware, some laptops i8k reports these fans in re-
verse order.
i8k_right_fan_rpm
- If running the i8k kernel driver for Inspiron laptops, displays
- the right fan's rate of rotation, in revolutions per minute as
+ If running the i8k kernel driver for Inspiron laptops, displays
+ the right fan's rate of rotation, in revolutions per minute as
listed in /proc/i8k. Beware, some laptops i8k reports these fans
in reverse order.
i8k_right_fan_status
- If running the i8k kernel driver for Inspiron laptops, displays
- the right fan status as listed in /proc/i8k (translated to hu-
- man-readable). Beware, some laptops i8k reports these fans in
+ If running the i8k kernel driver for Inspiron laptops, displays
+ the right fan status as listed in /proc/i8k (translated to hu-
+ man-readable). Beware, some laptops i8k reports these fans in
reverse order.
i8k_serial
- If running the i8k kernel driver for Inspiron laptops, displays
+ If running the i8k kernel driver for Inspiron laptops, displays
your laptop serial number as listed in /proc/i8k.
i8k_version
- If running the i8k kernel driver for Inspiron laptops, displays
+ If running the i8k kernel driver for Inspiron laptops, displays
the version formatting of /proc/i8k.
ibm_temps N
- If running the IBM ACPI, displays the temperatures from the IBM
+ If running the IBM ACPI, displays the temperatures from the IBM
temperature sensors (N=0..7) Sensor 0 is on the CPU, 3 is on the
GPU.
ibm_volume
- If running the IBM ACPI, displays the "master" volume, con-
+ If running the IBM ACPI, displays the "master" volume, con-
trolled by the volume keys (0-14).
if_running (process)
- if PROCESS is running, display everything if_running and the
+ if PROCESS is running, display everything if_running and the
matching $endif
if_existing (file)
- if FILE exists, display everything between if_existing and the
+ if FILE exists, display everything between if_existing and the
matching $endif
if_mounted (mountpoint)
- if MOUNTPOINT is mounted, display everything between if_mounted
+ if MOUNTPOINT is mounted, display everything between if_mounted
and the matching $endif
imap_messages (args)
Displays the number of messages in your global IMAP inbox by de-
- fault. You can define individual IMAP inboxes seperately by
+ fault. You can define individual IMAP inboxes seperately by
passing arguments to this object. Arguments are: "host user pass
- [-i interval] [-p port] [-e command]". Default port is 143, de-
+ [-i interval] [-p port] [-e command]". Default port is 143, de-
fault interval is 5 minutes. If the password is supplied as '*',
you will be prompted to enter the password when Conky starts.
Displays the number of unseen messages in your global IMAP inbox
by default. You can define individual IMAP inboxes seperately by
passing arguments to this object. Arguments are: "host user pass
- [-i interval] [-p port] [-e command]". Default port is 143, de-
+ [-i interval] [-p port] [-e command]". Default port is 143, de-
fault interval is 5 minutes. If the password is supplied as '*',
you will be prompted to enter the password when Conky starts.
Machine, i686 for example
- mails Mail count in mail spool. You can use program like fetchmail to
- get mails from some server using your favourite protocol. See
+ mails Mail count in mail spool. You can use program like fetchmail to
+ get mails from some server using your favourite protocol. See
also new_mails.
pb_battery item
If running on Apple powerbook/ibook, display information on bat-
- tery status. The item parameter specifies, what information to
+ tery status. The item parameter specifies, what information to
display. Exactly one item must be specified. Valid items are:
status: Display if battery is fully charged, charging, discharg-
ing or absent (running on AC)
- percent: Display charge of battery in percent, if charging or
- discharging. Nothing will be displayed, if battery is fully
+ percent: Display charge of battery in percent, if charging or
+ discharging. Nothing will be displayed, if battery is fully
charged or absent.
time: Display the time remaining until the battery will be fully
- charged or discharged at current rate. Nothing is displayed, if
- battery is absent or if it's present but fully charged and not
+ charged or discharged at current rate. Nothing is displayed, if
+ battery is absent or if it's present but fully charged and not
discharging.
Displays the number of unseen messages in your global POP3 inbox
by default. You can define individual POP3 inboxes seperately by
passing arguments to this object. Arguments are: "host user pass
- [-i interval] [-p port] [-e command]". Default port is 110, de-
+ [-i interval] [-p port] [-e command]". Default port is 110, de-
fault interval is 5 minutes. If the password is supplied as '*',
you will be prompted to enter the password when Conky starts.
pop3_used (args)
- Displays the amount of space (in MiB, 2^20) used in your global
- POP3 inbox by default. You can define individual POP3 inboxes
- seperately by passing arguments to this object. Arguments are:
- "host user pass [-i interval] [-p port] [-e command]". Default
- port is 110, default interval is 5 minutes. If the password is
+ Displays the amount of space (in MiB, 2^20) used in your global
+ POP3 inbox by default. You can define individual POP3 inboxes
+ seperately by passing arguments to this object. Arguments are:
+ "host user pass [-i interval] [-p port] [-e command]". Default
+ port is 110, default interval is 5 minutes. If the password is
supplied as '*', you will be prompted to enter the password when
Conky starts.
The connection index provides you with access to each connection
in the port monitor. The monitor will return information for in-
dex values from 0 to n-1 connections. Values higher than n-1 are
- simply ignored. For the "count" item, the connection index must
+ simply ignored. For the "count" item, the connection index must
be omitted. It is required for all other items.
Examples:
- ${tcp_portmon 6881 6999 count} - displays the number of connec-
+ ${tcp_portmon 6881 6999 count} - displays the number of connec-
tions in the bittorrent port range
- ${tcp_portmon 22 22 rip 0} - displays the remote host ip of the
+ ${tcp_portmon 22 22 rip 0} - displays the remote host ip of the
first sshd connection
- ${tcp_portmon 22 22 rip 9} - displays the remote host ip of the
+ ${tcp_portmon 22 22 rip 9} - displays the remote host ip of the
tenth sshd connection
${tcp_portmon 1 1024 rhost 0} - displays the remote host name of
the first connection on a privileged port
${tcp_portmon 1 1024 rport 4} - displays the remote host port of
the fifth connection on a privileged port
- ${tcp_portmon 1 65535 lservice 14} - displays the local service
+ ${tcp_portmon 1 65535 lservice 14} - displays the local service
name of the fifteenth connection in the range of all ports
Note that port monitor variables which share the same port range
actually refer to the same monitor, so many references to a sin-
gle port range for different items and different indexes all use
- the same monitor internally. In other words, the program avoids
+ the same monitor internally. In other words, the program avoids
creating redundant monitors.
texeci interval command
- Runs a command at an interval inside a thread and displays the
- output. Same as $execi, except the command is run inside a
- thread. Use this if you have a slow script to keep Conky updat-
- ing. You should make the interval slightly longer then the time
- it takes your script to execute. For example, if you have a
- script that take 5 seconds to execute, you should make the in-
+ Runs a command at an interval inside a thread and displays the
+ output. Same as $execi, except the command is run inside a
+ thread. Use this if you have a slow script to keep Conky updat-
+ ing. You should make the interval slightly longer then the time
+ it takes your script to execute. For example, if you have a
+ script that take 5 seconds to execute, you should make the in-
terval at least 6 seconds. See also $execi.
time (format)
- Local time, see man strftime to get more information about for-
+ Local time, see man strftime to get more information about for-
mat
tztime (timezone) (format)
- Local time for specified timezone, see man strftime to get more
- information about format. The timezone argument is specified in
- similar fashion as TZ environment variable. For hints, look in
+ Local time for specified timezone, see man strftime to get more
+ information about format. The timezone argument is specified in
+ similar fashion as TZ environment variable. For hints, look in
/usr/share/zoneinfo. e.g. US/Pacific, Europe/Zurich, etc.
totaldown net
- Total download, overflows at 4 GB on Linux with 32-bit arch and
+ Total download, overflows at 4 GB on Linux with 32-bit arch and
there doesn't seem to be a way to know how many times it has al-
ready done that before conky has started.
top type, num
- This takes arguments in the form:top (name) (number) Basically,
- processes are ranked from highest to lowest in terms of cpu us-
- age, which is what (num) represents. The types are: "name",
- "pid", "cpu", and "mem". There can be a max of 10 processes
+ This takes arguments in the form:top (name) (number) Basically,
+ processes are ranked from highest to lowest in terms of cpu us-
+ age, which is what (num) represents. The types are: "name",
+ "pid", "cpu", and "mem". There can be a max of 10 processes
listed.
Upload speed in kilobytes with one decimal
- upspeedgraph net (height),(width) (gradient colour 1) (gradient colour
+ upspeedgraph net (height),(width) (gradient colour 1) (gradient colour
2) (scale)
- Upload speed graph, colours defined in hex, minus the #. If
+ Upload speed graph, colours defined in hex, minus the #. If
scale is non-zero, it becomes the scale for the graph.
voffset (pixels)
- Change vertical offset by N pixels. Negative values will cause
+ Change vertical offset by N pixels. Negative values will cause
text to overlap. See also $offset.
voltage_mv (n)
- Returns CPU #n's voltage in mV. CPUs are counted from 1. If
+ Returns CPU #n's voltage in mV. CPUs are counted from 1. If
omitted, the parameter defaults to 1.
BUGS
Drawing to root or some other desktop window directly doesn't work with
all window managers. Especially doesn't work well with Gnome and it has
- been reported that it doesn't work with KDE either. Nautilus can be
- disabled from drawing to desktop with program gconf-editor. Uncheck
- show_desktop in /apps/nautilus/preferences/. There is -w switch in
- Conky to set some specific window id. You might find xwininfo -tree
- useful to find the window to draw to. You can also use -o argument
+ been reported that it doesn't work with KDE either. Nautilus can be
+ disabled from drawing to desktop with program gconf-editor. Uncheck
+ show_desktop in /apps/nautilus/preferences/. There is -w switch in
+ Conky to set some specific window id. You might find xwininfo -tree
+ useful to find the window to draw to. You can also use -o argument
which makes Conky to create its own window.
SEE ALSO
LICENSE="BSD"
SLOT="0"
KEYWORDS="~alpha ~amd64 ~ppc ~ppc64 ~sparc ~x86"
-IUSE="truetype X ipv6 audacious bmpx hddtemp mpd vim-syntax"
+IUSE="truetype X ipv6 audacious bmpx hddtemp mpd network vim-syntax"
DEPEND_COMMON="
virtual/libc
bmpx? ( media-sound/bmpx
>=sys-apps/dbus-0.35
)
+ network? ( net-libs/libdexter
+ net-libs/dxt-plugins-sysinfo
+ )
!ipv6? ( >=dev-libs/glib-2.0 )
)"
mymake="MPD_NO_IPV6=noipv6"
fi
local myconf
- myconf="--enable-own-window --enable-proc-uptime"
+ myconf="--enable-own-window"
use X && myconf="${myconf} --enable-x11 --enable-double-buffer --enable-xdamage"
econf \
${myconf} \
$(use_enable audacious) \
$(use_enable bmpx) \
$(use_enable hddtemp ) \
+ $(use_enable network ) \
$(use_enable mpd) \
$(use_enable !ipv6 portmon) || die "econf failed"
emake ${mymake} || die "compile failed"
echo Running $ACLOCAL ... && $ACLOCAL
echo Running $LIBTOOLIZE --force ... && $LIBTOOLIZE --force
echo Running $AUTOHEADER ... && $AUTOHEADER
-echo Running $AUTOMAKE -a ... && $AUTOMAKE -a
+echo Running $AUTOMAKE --add-missing ... && $AUTOMAKE --add-missing
echo Running $AUTOCONF ... && $AUTOCONF
dnl major, minor and micro version macros.
m4_define([conky_version_major], [1])
-m4_define([conky_version_minor], [4])
-m4_define([conky_version_micro], [6])
+m4_define([conky_version_minor], [5])
+m4_define([conky_version_micro], [0])
m4_define([conky_version_tag], [svn]) dnl [] for releases
m4_define([conky_version_revision],[r@REVISION@])
m4_define([conky_version],
- [conky_version_major().conky_version_minor().conky_version_micro()ifelse(
- conky_version_tag(), [svn],
- [-conky_version_tag()-conky_version_revision()],
- [ifelse(conky_version_tag(), [], [], [-conky_version_tag()])])])
+ [conky_version_major().conky_version_minor().conky_version_micro()ifelse(
+ conky_version_tag(), [svn],
+ [-conky_version_tag()-conky_version_revision()],
+ [ifelse(conky_version_tag(), [], [], [-conky_version_tag()])])])
AC_INIT([Conky], [conky_version()], [brenden1@users.sourceforge.net])
AM_INIT_AUTOMAKE(conky, conky_version())
AM_CONFIG_HEADER(src/config.h)
-dnl
-dnl C Compiler
-dnl
dnl prevent libtool setting LTCFLAGS to default of -g -O2 when CFLAGS unset.
dnl libtool must be deleted with make distclean to see this fix.
if test x"$CFLAGS" = x""; then
- AC_SUBST(CFLAGS, [ ])
+ AC_SUBST(CFLAGS, [ ])
fi
+dnl
+dnl Tools
+dnl
AC_PROG_CC
+AC_PROG_LD
+AC_PROG_INSTALL
AC_PROG_LIBTOOL
-PKG_PROG_PKG_CONFIG([0.17.2])
+AC_CHECK_PROG(HAVE_PKGCONFIG, pkg-config, yes, no)
+if test x"$HAVE_PKGCONFIG" = x"no"; then
+ AC_MSG_ERROR([pkg-config is required!])
+fi
+PKG_PROG_PKG_CONFIG([0.17.2])
AC_CONFIG_FILES(
- Makefile
- doc/Makefile
- src/Makefile
- src/build.h
- )
+ Makefile
+ doc/Makefile
+ src/Makefile
+ src/build.h
+ )
uname=`uname`
dnl
AC_ARG_ENABLE([own_window],
- AC_HELP_STRING([--enable-own-window], [enable if you want support for creating own window @<:@default=yes@:>@]),
- [dah="$enableval"], [dah=yes])
+ AC_HELP_STRING([--disable-own-window],
+ [disable if you do not want support for creating own window @<:@default=yes@:>@]),
+ [dah="$enableval"], [dah=yes])
if test $dah != "no"; then
AC_DEFINE(OWN_WINDOW, 1, [Define if you want support for window creating])
fi
-dnl
-dnl PROC_UPTIME option
-dnl
-
-AC_ARG_ENABLE([proc_uptime],
- AC_HELP_STRING([--enable-proc-uptime], [enable using /proc/uptime for uptime @<:@default=yes@:>@]),
- [dah="$enableval"], [dah=yes])
-
-if test $dah = "yes"; then
- AC_DEFINE(PROC_UPTIME, 1, [Define if you want to use /proc/uptime for uptime])
-fi
-
dnl
dnl Audacious Media Player
dnl
AC_ARG_ENABLE([audacious],
- AC_HELP_STRING([--enable-audacious], [enable audacious player support @<:@default=no@:>@]),
- [want_audacious="$enableval"], [want_audacious=no])
+ AC_HELP_STRING([--enable-audacious], [enable audacious player support @<:@default=no@:>@]),
+ [want_audacious="$enableval"], [want_audacious=no])
AM_CONDITIONAL(BUILD_AUDACIOUS, test x$want_audacious = xyes)
if test x$want_audacious = xyes; then
- PKG_CHECK_MODULES([AUDACIOUS], [audacious >= 0.1])
- CFLAGS="$CFLAGS $AUDACIOUS_CFLAGS"
- LIBS="$LIBS $AUDACIOUS_LIBS"
- AC_DEFINE(AUDACIOUS, 1, [Define for Audacious support])
+ PKG_CHECK_MODULES([AUDACIOUS], [audacious >= 0.1])
+ CFLAGS="$CFLAGS $AUDACIOUS_CFLAGS"
+ LIBS="$LIBS $AUDACIOUS_LIBS"
+ AC_DEFINE(AUDACIOUS, 1, [Define for Audacious support])
fi
dnl
AC_ARG_ENABLE([bmpx],
- AC_HELP_STRING([--enable-bmpx], [enable if you want BMPx support @<:@default=no@:>@]),
- [want_bmpx="$enableval"], [want_bmpx=no])
+ AC_HELP_STRING([--enable-bmpx], [enable if you want BMPx support @<:@default=no@:>@]),
+ [want_bmpx="$enableval"], [want_bmpx=no])
AM_CONDITIONAL(BUILD_BMPX, test x$want_bmpx = xyes)
if test x$want_bmpx = xyes; then
- PKG_CHECK_MODULES([BMPX], [bmp-2.0 >= 0.14.0])
- CFLAGS="$CFLAGS $BMPX_CFLAGS"
- LIBS="$LIBS $BMPX_LIBS"
- AC_DEFINE(BMPX, 1, [Define if you want BMPx support])
+ PKG_CHECK_MODULES([BMPX], [bmp-2.0 >= 0.14.0])
+ CFLAGS="$CFLAGS $BMPX_CFLAGS"
+ LIBS="$LIBS $BMPX_LIBS"
+ AC_DEFINE(BMPX, 1, [Define if you want BMPx support])
fi
dnl
AC_ARG_ENABLE([hddtemp],
- AC_HELP_STRING([--enable-hddtemp], [enable if you want hddtemp support @<:@default=yes@:>@]),
- [want_hddtemp="$enableval"], [want_hddtemp=yes])
+ AC_HELP_STRING([--disable-hddtemp],
+ [disable if you do not want hddtemp support @<:@default=yes@:>@]),
+ [want_hddtemp="$enableval"], [want_hddtemp=yes])
AM_CONDITIONAL(BUILD_HDDTEMP, test x$want_hddtemp = xyes)
if test x$want_hddtemp = xyes; then
dnl
AC_ARG_ENABLE([mpd],
- AC_HELP_STRING([--enable-mpd], [enable if you want MPD support @<:@default=yes@:>@]),
- [want_mpd="$enableval"], [want_mpd=yes])
+ AC_HELP_STRING([--disable-mpd], [disable if you do not want MPD support @<:@default=yes@:>@]),
+ [want_mpd="$enableval"], [want_mpd=yes])
AM_CONDITIONAL(BUILD_MPD, test x$want_mpd = xyes)
if test x$want_mpd = xyes; then
dnl
AC_ARG_ENABLE([xmms2],
- AC_HELP_STRING([--enable-xmms2], [enable if you want XMMS2 support @<:@default=no@:>@]),
- [want_xmms2="$enableval"], [want_xmms2=no])
+ AC_HELP_STRING([--enable-xmms2], [enable if you want XMMS2 support @<:@default=no@:>@]),
+ [want_xmms2="$enableval"], [want_xmms2=no])
AM_CONDITIONAL(BUILD_XMMS2, test x$want_xmms2 = xyes)
if test x$want_xmms2 = xyes; then
- PKG_CHECK_MODULES([XMMS2], [xmms2-client])
- CFLAGS="$CFLAGS $XMMS2_CFLAGS"
- LIBS="$LIBS $XMMS2_LIBS"
- AC_DEFINE(XMMS2, 1, [Define if you want XMMS2 support])
+ PKG_CHECK_MODULES([XMMS2], [xmms2-client])
+ CFLAGS="$CFLAGS $XMMS2_CFLAGS"
+ LIBS="$LIBS $XMMS2_LIBS"
+ AC_DEFINE(XMMS2, 1, [Define if you want XMMS2 support])
fi
dnl
dnl AM_CONDITIONAL(BUILD_IMLIB2, test x$want_imlib2 = xyes)
dnl if test x$want_imlib2 = xyes; then
-dnl PKG_CHECK_MODULES([Imlib2], [imlib2])
-dnl CFLAGS="$CFLAGS $Imlib2_CFLAGS"
-dnl LIBS="$LIBS $Imlib2_LIBS"
-dnl AC_DEFINE(IMLIB2, 1, [Define if you want Imlib2 support])
+dnl PKG_CHECK_MODULES([Imlib2], [imlib2])
+dnl CFLAGS="$CFLAGS $Imlib2_CFLAGS"
+dnl LIBS="$LIBS $Imlib2_LIBS"
+dnl AC_DEFINE(IMLIB2, 1, [Define if you want Imlib2 support])
dnl fi
+
dnl
dnl PORT_MONITORS
dnl
AC_ARG_ENABLE([portmon],
- AC_HELP_STRING([--enable-portmon], [enable if you want tcp (ip4) port monitoring @<:@default=yes@:>@]),
- [want_portmon="$enableval"], [want_portmon=yes])
+ AC_HELP_STRING([--disable-portmon],
+ [disable if you do not want tcp (ip4) port monitoring @<:@default=yes@:>@]),
+ [want_portmon="$enableval"], [want_portmon=yes])
AM_CONDITIONAL(BUILD_PORT_MONITORS, test x$want_portmon = xyes)
if test x$want_portmon = xyes; then
- if test "x$uname" != xLinux; then
- AC_MSG_NOTICE([port monitors not supported on $uname... disabling])
- want_portmon=no
- else
- AC_CHECK_HEADERS([netdb.h netinet/in.h netinet/tcp.h sys/socket.h arpa/inet.h], [],
- [PORT_MONITORS_MISSING=yes])
- if test "x$PORT_MONITORS_MISSING" = xyes; then
- AC_MSG_ERROR([missing a needed network header for port monitoring])
- fi
- PKG_CHECK_MODULES([GLIB], [glib-2.0])
- CFLAGS="$CFLAGS $GLIB_CFLAGS"
- LIBS="$LIBS $GLIB_LIBS"
- AC_DEFINE(TCP_PORT_MONITOR, 1, [Define if you want tcp port monitoring support])
- fi
+ if test "x$uname" != xLinux; then
+ AC_MSG_NOTICE([port monitors not supported on $uname... disabling])
+ want_portmon=no
+ else
+ AC_CHECK_HEADERS([netdb.h netinet/in.h netinet/tcp.h sys/socket.h arpa/inet.h], [],
+ [PORT_MONITORS_MISSING=yes])
+ if test "x$PORT_MONITORS_MISSING" = xyes; then
+ AC_MSG_ERROR([missing a needed network header for port monitoring])
+ fi
+ PKG_CHECK_MODULES([GLIB], [glib-2.0])
+ CFLAGS="$CFLAGS $GLIB_CFLAGS"
+ LIBS="$LIBS $GLIB_LIBS"
+ AC_DEFINE(TCP_PORT_MONITOR, 1, [Define if you want tcp port monitoring support])
+ fi
+fi
+
+
+dnl
+dnl Network-based monitoring
+dnl
+
+AC_ARG_ENABLE([network],
+ AC_HELP_STRING([--disable-network],
+ [disable if you do not want distributed monitoring @<:@default=yes@:>@]),
+ [want_network="$enableval"], [want_network=yes])
+if test x"$want_network" = x"yes"; then
+ PKG_CHECK_MODULES([LIBDEXTER], [dexter], [], [AC_MSG_RESULT([no]); want_network=no])
+ if test x"$want_network" = x"yes"; then
+ dnl need GNU string stream extensions
+ AC_CHECK_FUNCS([fmemopen open_memstream flockfile funlockfile putc_unlocked], [], [want_network=no])
+ if test x"$want_network" = x"yes"; then
+ CFLAGS="$CFLAGS $LIBDEXTER_CFLAGS"
+ LIBS="$LIBS $LIBDEXTER_LIBS"
+ AC_DEFINE([HAVE_LIBDEXTER], 1, [Define if using Libdexter])
+ dnl _GNU_SOURCE needed for fmemopen, open_memstream
+ AC_DEFINE([_GNU_SOURCE], [], [Define for GNU source and extensions])
+ fi
+ fi
fi
AM_ICONV
if test "$am_cv_func_iconv" != yes; then
- AC_MSG_WARN([Could not find libiconv])
+ AC_MSG_WARN([Could not find libiconv])
else
- LIBS="$LIBS $LIBICONV"
+ LIBS="$LIBS $LIBICONV"
fi
dnl
dnl
AC_ARG_ENABLE([debug],
- AC_HELP_STRING([--enable-debug], [compile with debug symbols @<:@default=no@:>@]),
- [want_debug="$enableval"], [want_debug=no])
+ AC_HELP_STRING([--enable-debug], [compile with debug symbols @<:@default=no@:>@]),
+ [want_debug="$enableval"], [want_debug=no])
if test "x$want_debug" = "xyes" -a $ac_cv_c_compiler_gnu != no; then
- CFLAGS="$CFLAGS -g3"
+ CFLAGS="$CFLAGS -g3"
+ AC_DEFINE([DEBUG], [], [Define for debugging])
fi
dnl
dnl
AC_ARG_ENABLE([x11],
- AC_HELP_STRING([--enable-x11], [enable if you want X11 support @<:@default=yes@:>@]),
- [want_x11="$enableval"], [want_x11=yes])
+ AC_HELP_STRING([--disable-x11], [disable if you do not want X11 support @<:@default=yes@:>@]),
+ [want_x11="$enableval"], [want_x11=yes])
AM_CONDITIONAL(BUILD_X11, test x$want_x11 = xyes)
if test "x$want_x11" = "xyes"; then
if $PKG_CONFIG --exists x11; then
- PKG_CHECK_MODULES([X11], [x11])
- CFLAGS="$CFLAGS $X11_CFLAGS"
- LIBS="$LIBS $X11_LIBS"
+ PKG_CHECK_MODULES([X11], [x11])
+ CFLAGS="$CFLAGS $X11_CFLAGS"
+ LIBS="$LIBS $X11_LIBS"
else
- dnl non-modular X11 installations
- AC_PATH_X
- AC_PATH_XTRA
- CFLAGS="$CFLAGS $X_CFLAGS"
- LIBS="$LIBS $X_LIBS"
- LDFLAGS="$LDFLAGS $LIBS $X_PRE_LIBS"
- if test "x$no_x" = "xyes"; then
- AC_MSG_ERROR([Can't locate your X11 installation])
- fi
- AC_CHECK_LIB([X11], [XOpenDisplay], [], AC_MSG_ERROR([Could not find XOpenDisplay in -lX11]))
+ dnl non-modular X11 installations
+ AC_PATH_X
+ AC_PATH_XTRA
+ CFLAGS="$CFLAGS $X_CFLAGS"
+ LIBS="$LIBS $X_LIBS"
+ LDFLAGS="$LDFLAGS $LIBS $X_PRE_LIBS"
+ if test "x$no_x" = "xyes"; then
+ AC_MSG_ERROR([Can't locate your X11 installation])
+ fi
+ AC_CHECK_LIB([X11], [XOpenDisplay], [], AC_MSG_ERROR([Could not find XOpenDisplay in -lX11]))
fi
AC_DEFINE(X11, 1, [Define if you want to use X11])
fi
-
+
dnl
dnl Xext Double-buffering Extension
dnl
AC_ARG_ENABLE([double_buffer],
- AC_HELP_STRING([--enable-double-buffer], [enable for flicker-free operation @<:@default=yes@:>@]),
- [want_double_buffer="$enableval"], [want_double_buffer=yes])
+ AC_HELP_STRING([--disable-double-buffer],
+ [disable for no Xdbe double-buffering support @<:@default=yes@:>@]),
+ [want_double_buffer="$enableval"], [want_double_buffer=yes])
if test "x$want_double_buffer" = "xyes"; then
if test "x$want_x11" != "xyes"; then
- AC_MSG_ERROR([--enable-x11 is required for double-buffering])
- fi
- if $PKG_CONFIG --exists xext; then
- PKG_CHECK_MODULES([XEXT],[xext])
- CFLAGS="$CFLAGS $XEXT_CFLAGS"
- LIBS="$LIBS $XEXT_LIBS"
- else
- dnl non-modular X11 installation
- AC_CHECK_LIB([Xext], [XdbeQueryExtension], [LIBS="$LIBS -lXext"],
- AC_MSG_ERROR([Could not find XdbeQueryExtension in -lXext]))
+ dnl silently disable if no x11
+ want_double_buffer=no
+ else
+ if $PKG_CONFIG --exists xext; then
+ PKG_CHECK_MODULES([XEXT],[xext])
+ CFLAGS="$CFLAGS $XEXT_CFLAGS"
+ LIBS="$LIBS $XEXT_LIBS"
+ else
+ dnl non-modular X11 installation
+ AC_CHECK_LIB([Xext], [XdbeQueryExtension], [LIBS="$LIBS -lXext"],
+ AC_MSG_ERROR([Could not find XdbeQueryExtension in -lXext]))
+ fi
+ AC_DEFINE(HAVE_XDBE, 1, [Define for X11 double-buffering])
fi
- AC_DEFINE(HAVE_XDBE, 1, [Define for X11 double-buffering])
fi
dnl
AC_ARG_ENABLE([xdamage],
- AC_HELP_STRING([--enable-xdamage], [enable if you want Xdamage support @<:@default=yes@:>@]),
- [want_xdamage="$enableval"], [want_xdamage=yes])
+ AC_HELP_STRING([--disable-xdamage],
+ [disable if you do not want Xdamage support @<:@default=yes@:>@]),
+ [want_xdamage="$enableval"], [want_xdamage=yes])
if test "x$want_xdamage" = "xyes"; then
if test "x$want_x11" != "xyes"; then
- AC_MSG_ERROR([--enable-x11 is required for xdamage])
+ dnl silently disable if no x11
+ want_xdamage=no
+ else
+ if $PKG_CONFIG --exists xdamage; then
+ PKG_CHECK_MODULES([XDAMAGE],[xdamage])
+ CFLAGS="$CFLAGS $XDAMAGE_CFLAGS"
+ LIBS="$LIBS $XDAMAGE_LIBS"
+ else
+ dnl non-modular X11 installation
+ AC_CHECK_LIB([Xdamage], [XDamageQueryExtension], [LIBS="$LIBS -lXdamage"],
+ AC_MSG_ERROR([Could not find XDamageQueryExtension in -lXdamage]))
+ fi
+ AC_DEFINE(HAVE_XDAMAGE, 1, [Define for X11 Xdamage extension])
fi
- if $PKG_CONFIG --exists xdamage; then
- PKG_CHECK_MODULES([XDAMAGE],[xdamage])
- CFLAGS="$CFLAGS $XDAMAGE_CFLAGS"
- LIBS="$LIBS $XDAMAGE_LIBS"
- else
- dnl non-modular X11 installation
- AC_CHECK_LIB([Xdamage], [XDamageQueryExtension], [LIBS="$LIBS -lXdamage"],
- AC_MSG_ERROR([Could not find XDamageQueryExtension in -lXdamage]))
- fi
- AC_DEFINE(HAVE_XDAMAGE, 1, [Define for X11 Xdamage extension])
fi
dnl
AC_ARG_ENABLE([xft],
- AC_HELP_STRING([--enable-xft], [enable if you want to use Xft @<:@default=yes@:>@]),
- [want_xft="$enableval"], [want_xft=yes])
+ AC_HELP_STRING([--disable-xft], [disable if you do not want to use Xft @<:@default=yes@:>@]),
+ [want_xft="$enableval"], [want_xft=yes])
if test x$want_xft = "xyes"; then
if test "x$want_x11" != "xyes"; then
- AC_MSG_ERROR([--enable-x11 is required for xft])
+ dnl silently disable if no x11
+ want_xft=no
+ else
+ PKG_CHECK_MODULES(XFT, [xft])
+ CFLAGS="$CFLAGS $XFT_CFLAGS"
+ LIBS="$LIBS $XFT_LIBS"
+ AC_DEFINE(XFT, 1, [Define for Xft support])
fi
- PKG_CHECK_MODULES(XFT, [xft])
- CFLAGS="$CFLAGS $XFT_CFLAGS"
- LIBS="$LIBS $XFT_LIBS"
- AC_DEFINE(XFT, 1, [Define for Xft support])
fi
if test x$WANT_KVM = xyes; then
AC_CHECK_LIB(kvm, kvm_open,
- LIBS="$LIBS -lkvm",
- AC_MSG_ERROR([Could not find kvm_open in -lkvm.])
+ LIBS="$LIBS -lkvm",
+ AC_MSG_ERROR([Could not find kvm_open in -lkvm.])
)
fi
dnl
if test x$WANT_DEVSTAT = xyes; then
- AC_CHECK_LIB(devstat, devstat_getversion,
- LIBS="$LIBS -ldevstat",
- AC_MSG_ERROR([Cound not find devstat_getversion in -ldevstat.])
- )
+ AC_CHECK_LIB(devstat, devstat_getversion,
+ LIBS="$LIBS -ldevstat",
+ AC_MSG_ERROR([Cound not find devstat_getversion in -ldevstat.])
+ )
fi
dnl
if test x$WANT_OSSLIB = xyes; then
AC_CHECK_LIB(ossaudio, _oss_ioctl,
- LIBS="$LIBS -lossaudio",
- AC_MSG_ERROR([Could not find oss_ioctl in -lossaudio.])
+ LIBS="$LIBS -lossaudio",
+ AC_MSG_ERROR([Could not find oss_ioctl in -lossaudio.])
)
fi
dnl
AC_CHECK_HEADERS([signal.h unistd.h sys/utsname.h sys/stat.h linux/soundcard.h dirent.h mcheck.h \
- sys/statfs.h sys/param.h pthread.h assert.h errno.h time.h])
+ sys/statfs.h sys/param.h pthread.h assert.h errno.h time.h])
AC_CHECK_HEADERS([sys/mount.h], [], [],
- [#ifdef HAVE_SYS_PARAM_H
- #include <sys/param.h>
- #endif
- ])
+ [#ifdef HAVE_SYS_PARAM_H
+ #include <sys/param.h>
+ #endif
+ ])
dnl
dnl Some functions
dnl
-AC_CHECK_FUNCS([calloc malloc free popen])
+AC_CHECK_FUNCS([calloc malloc free popen sysinfo getloadavg])
AC_SEARCH_LIBS(clock_gettime, [rt], [], AC_MSG_ERROR([clock_gettime() not found]))
AC_CHECK_PROGS(db2x_manxml_cmd, db2x_manxml)
AC_CHECK_PROGS(xsltproc_cmd, xsltproc)
if test x$db2x_xsltproc_cmd = "x" -o x$xsltproc_cmd = "x"; then
- AM_CONDITIONAL(HAVE_DOCSTUFF, false)
+ AM_CONDITIONAL(HAVE_DOCSTUFF, false)
else
- AM_CONDITIONAL(HAVE_DOCSTUFF, true)
+ AM_CONDITIONAL(HAVE_DOCSTUFF, true)
fi
-dnl
-dnl Check sysinfo()
-dnl
-
-if test x$WANT_SYSINFO = xyes; then
- dah=no
- AC_MSG_CHECKING(for sysinfo)
- AC_TRY_COMPILE(
- [#include <sys/types.h>
- #include <sys/sysinfo.h>],
- [struct sysinfo s; sysinfo(&s); (void) s.uptime; ],
- [AC_MSG_RESULT(yes); dah=yes],
- [AC_MSG_RESULT(not usable); dah=no])
-
- if test x$dah = xyes; then
- AC_DEFINE(HAVE_SYSINFO, 1, [Define if you have sysinfo (Linux)])
- fi
-fi
dnl
dnl kstat in Solaris
fi
])
-dnl
-dnl Check getloadavg
-dnl
-AC_MSG_CHECKING(for getloadavg)
-AC_TRY_COMPILE(
- [#include <stdlib.h>],
- [double v[3]; getloadavg(v, 3);],
- [AC_MSG_RESULT(yes)
- AC_DEFINE(HAVE_GETLOADAVG, 1, [Define if you have getloadavg])],
- [AC_MSG_RESULT(no)])
+dnl ************************
+dnl * Linker optimizations *
+dnl ************************
+AC_MSG_CHECKING([if $LD accepts -O1])
+case `$LD -O1 -v 2>&1 </dev/null` in
+*GNU* | *BSD*)
+ LDFLAGS="$LDFLAGS -Wl,-O1"
+ AC_MSG_RESULT([yes])
+ ;;
+*)
+ AC_MSG_RESULT([no])
+ ;;
+esac
dnl
$PACKAGE $VERSION configured successfully:
- Installing into: $prefix
- C compiler flags: $CFLAGS
- Linker flags: $LDFLAGS
- Libraries: $LIBS
+ Installing into: $prefix
+ C compiler flags: $CFLAGS
+ Linker flags: $LDFLAGS
+ Libraries: $LIBS
* x11:
- x11 support: $want_x11
- xdamage support: $want_xdamage
- xdbe support: $want_double_buffer
- xft support: $want_xft
+ x11 support: $want_x11
+ xdamage support: $want_xdamage
+ xdbe support: $want_double_buffer
+ xft support: $want_xft
* music detection:
- audacious: $want_audacious
- bmpx: $want_bmpx
- mpd: $want_mpd
- xmms2: $want_xmms2
+ audacious: $want_audacious
+ bmpx: $want_bmpx
+ mpd: $want_mpd
+ xmms2: $want_xmms2
* general:
- hddtemp: $want_hddtemp
- portmon: $want_portmon
-
+ hddtemp: $want_hddtemp
+ portmon: $want_portmon
+ network: $want_network
EOF
</varlistentry>
<varlistentry>
+ <term><command><option>dexter_client</option></command></term>
+ <listitem>
+ Act as client and connect to libdexter server for remote monitoring?
+ <para></para></listitem>
+</varlistentry>
+
+<varlistentry>
+ <term><command><option>dexter_config</option></command></term>
+ <listitem>
+ Full path to libdexter configuration file (default search order: $HOME/.dexterrc; /etc/libdexter/dexter.conf)
+ <para></para></listitem>
+</varlistentry>
+
+<varlistentry>
+ <term><command><option>dexter_server</option></command></term>
+ <listitem>
+ Act as server for libdexter services?
+ <para></para></listitem>
+</varlistentry>
+
+<varlistentry>
<term><command><option>double_buffer</option></command></term>
<listitem>
Use the Xdbe extension? (eliminates flicker) It is highly recommended to use own window with this one so double buffer won't be so big.
</varlistentry>
<varlistentry>
- <term><command><option>own_window_transparent</option></command></term>
- <listitem>
- Boolean, set pseudo-transparency?
- <para></para></listitem>
-</varlistentry>
-
-<varlistentry>
- <term><command><option>own_window_type</option></command></term>
- <listitem>
- if own_window is yes, you may specify type normal, desktop or override (default: normal).
- Desktop windows are special windows that have no window decorations; are always visible
- on your desktop; do not appear in your pager or taskbar; and are sticky across all workspaces.
- Override windows are not under the control of the window manager. Hints are ignored. This type
- of window can be useful for certain situations.
- <para></para></listitem>
+ <term><command><option>own_window_class</option></command></term>
+ <listitem>
+ Manually set the WM_CLASS name. Defaults to "Conky".
+ <para></para></listitem>
</varlistentry>
<varlistentry>
</varlistentry>
<varlistentry>
+ <term><command><option>own_window_title</option></command></term>
+ <listitem>
+ Manually set the window name. Defaults to "<hostname> - conky".
+ <para></para></listitem>
+</varlistentry>
+
+<varlistentry>
+ <term><command><option>own_window_transparent</option></command></term>
+ <listitem>
+ Boolean, set pseudo-transparency?
+ <para></para></listitem>
+</varlistentry>
+
+<varlistentry>
+ <term><command><option>own_window_type</option></command></term>
+ <listitem>
+ if own_window is yes, you may specify type normal, desktop or override (default: normal).
+ Desktop windows are special windows that have no window decorations; are always visible
+ on your desktop; do not appear in your pager or taskbar; and are sticky across all workspaces.
+ Override windows are not under the control of the window manager. Hints are ignored. This type
+ of window can be useful for certain situations.
+ <para></para></listitem>
+</varlistentry>
+
+<varlistentry>
<term><command><option>out_to_console</option></command>
</term>
<listitem>
</varlistentry>
<varlistentry>
- <term><command><option>wm_class_name</option></command></term>
- <listitem>
- Manually set the WM_CLASS name. Defaults to "conky".
- <para></para></listitem>
-</varlistentry>
-
-<varlistentry>
<term><command><option>xftalpha</option></command></term>
<listitem>
Alpha of Xft font. Must be a value at or between 1 and 0.
.TP
\fB\*(T<\fBsh autogen.sh\fR\*(T>\fR \*(T<\fB# Only required if building from Svn\fR\*(T>
.TP
-\fB\*(T<\fB\&./configure \fR\*(T>\fR\*(T<\fB\-\-prefix=/usr \-\-mandir=/usr/share/man \-\-infodir=/usr/share/info \-\-datadir=/usr/share \-\-sysconfdir=/etc \-\-localstatedir=/var/lib \-\-enable\-xft \-\-enable\-own\-window \-\-enable\-proc\-uptime \-\-enable\-audacious \-\-enable\-bmpx \-\-enable\-hddtemp \-\-enable\-mpd \-\-enable\-xmms2 \-\-enable\-imlib2 \-\-enable\-portmon \-\-enable\-debug \-\-enable\-double\-buffer \-\-enable\-xdamage \-\-enable\-x11\fR\*(T>
+\fB\*(T<\fB\&./configure \fR\*(T>\fR\*(T<\fB\-\-prefix=/usr \-\-mandir=/usr/share/man \-\-infodir=/usr/share/info \-\-datadir=/usr/share \-\-sysconfdir=/etc \-\-localstatedir=/var/lib \-\-disable\-own\-window \-\-enable\-audacious \-\-enable\-bmpx \-\-disable\-hddtemp \-\-disable\-mpd \-\-enable\-xmms2 \-\-disable\-portmon \-\-disable\-network \-\-enable\-debug \-\-disable\-x11 \-\-disable\-double\-buffer \-\-disable\-xdamage \-\-disable\-xft\fR\*(T>
.TP
\fB\*(T<\fBmake\fR\*(T>\fR
.TP
Default shading color and border's shading color
.TP
+\fB\*(T<\fBdexter_client\fR\*(T>\fR
+Act as client and connect to libdexter server for remote monitoring?
+
+.TP
+\fB\*(T<\fBdexter_config\fR\*(T>\fR
+Full path to libdexter configuration file (default search order: $HOME/.dexterrc; /etc/libdexter/dexter.conf)
+
+.TP
+\fB\*(T<\fBdexter_server\fR\*(T>\fR
+Act as server for libdexter services?
+
+.TP
\fB\*(T<\fBdouble_buffer\fR\*(T>\fR
Use the Xdbe extension? (eliminates flicker) It is highly recommended to use own window with this one so double buffer won't be so big.
Boolean, create own window to draw?
.TP
-\fB\*(T<\fBown_window_transparent\fR\*(T>\fR
-Boolean, set pseudo-transparency?
-
-.TP
-\fB\*(T<\fBown_window_type\fR\*(T>\fR
-if own_window is yes, you may specify type normal, desktop or override (default: normal).
-Desktop windows are special windows that have no window decorations; are always visible
-on your desktop; do not appear in your pager or taskbar; and are sticky across all workspaces.
-Override windows are not under the control of the window manager. Hints are ignored. This type
-of window can be useful for certain situations.
+\fB\*(T<\fBown_window_class\fR\*(T>\fR
+Manually set the WM_CLASS name. Defaults to "Conky".
.TP
\fB\*(T<\fBown_window_colour\fR\*(T>\fR \*(T<\fBcolour\fR\*(T>
If you use own_window_type override, window manager hints have no meaning and are ignored.
.TP
+\fB\*(T<\fBown_window_title\fR\*(T>\fR
+Manually set the window name. Defaults to "<hostname> - conky".
+
+.TP
+\fB\*(T<\fBown_window_transparent\fR\*(T>\fR
+Boolean, set pseudo-transparency?
+
+.TP
+\fB\*(T<\fBown_window_type\fR\*(T>\fR
+if own_window is yes, you may specify type normal, desktop or override (default: normal).
+Desktop windows are special windows that have no window decorations; are always visible
+on your desktop; do not appear in your pager or taskbar; and are sticky across all workspaces.
+Override windows are not under the control of the window manager. Hints are ignored. This type
+of window can be useful for certain situations.
+
+.TP
\fB\*(T<\fBout_to_console\fR\*(T>\fR
Print text to stdout.
Use Xft (anti-aliased font and stuff)
.TP
-\fB\*(T<\fBwm_class_name\fR\*(T>\fR
-Manually set the WM_CLASS name. Defaults to "conky".
-
-.TP
\fB\*(T<\fBxftalpha\fR\*(T>\fR
Alpha of Xft font. Must be a value at or between 1 and 0.
default_shade_color black
default_outline_color black
+dexter_client no
+dexter_server no
+# config file for libdexter (default search path: $HOME/.dexterrc; /etc/libdexter/dexter.conf)
+dexter_config
+
# Text alignment, other possible values are commented
#alignment top_left
#alignment top_right
</varlistentry>
<varlistentry>
<term>
- <command><option>./configure </option></command><option>--prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --datadir=/usr/share --sysconfdir=/etc --localstatedir=/var/lib --enable-xft --enable-own-window --enable-proc-uptime --enable-audacious --enable-bmpx --enable-hddtemp --enable-mpd --enable-xmms2 --enable-imlib2 --enable-portmon --enable-debug --enable-double-buffer --enable-xdamage --enable-x11</option>
+ <command><option>./configure </option></command><option>--prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --datadir=/usr/share --sysconfdir=/etc --localstatedir=/var/lib --disable-own-window --enable-audacious --enable-bmpx --disable-hddtemp --disable-mpd --enable-xmms2 --disable-portmon --disable-network --enable-debug --disable-x11 --disable-double-buffer --disable-xdamage --disable-xft</option>
</term>
</varlistentry>
<varlistentry>
syntax "conky" "\.*conkyrc.*$"
## Configuration items
-color green "\<(alignment|background|border_margin|border_width|cpu_avg_samples|default_color|default_shade_color|default_outline_color|double_buffer|draw_borders|draw_graph_borders|draw_shades|draw_outline|font|gap_x|gap_y|imap|mail_spool|max_port_monitor_connections|max_specials|max_user_text|maximum_width|minimum_size|mpd_host|mpd_port|mpd_password|net_avg_samples|no_buffers|out_to_console|override_utf8_locale|own_window|own_window_transparent|own_window_type|own_window_hints|own_window_colour|pad_percents|pop3|stippled_borders|total_run_times|update_interval|uppercase|use_spacer|use_xft|wm_class_name|xftalpha|xftfont)\>"
+color green "\<(alignment|background|border_margin|border_width|cpu_avg_samples|default_color|default_shade_color|default_outline_color|dexter_client|dexter_config|dexter_server|double_buffer|draw_borders|draw_graph_borders|draw_shades|draw_outline|font|gap_x|gap_y|imap|mail_spool|max_port_monitor_connections|max_specials|max_user_text|maximum_width|minimum_size|mpd_host|mpd_port|mpd_password|net_avg_samples|no_buffers|out_to_console|override_utf8_locale|own_window|own_window_class|own_window_colour|own_window_hints|own_window_title|own_window_transparent|own_window_type|pad_percents|pop3|stippled_borders|total_run_times|update_interval|uppercase|use_spacer|use_xft|xftalpha|xftfont)\>"
## Variables
color brightblue "\<(acpiacadapter|acpifan|acpitemp|acpitempf|addr|adt746xcpu|adt746xfan|align|alignr|apm_adapter|apm_battery_life|apm_battery_time|audacious_bar|audacious_bitrate|audacious_channels|audacious_filename|audacious_frequency|audacious_length|audacious_length_seconds|audacious_playlist_length|audacious_playlist_position|audacious_position|audacious_position_seconds|audacious_status|audacious_title|battery|battery_time|bmpx_album|bmpx_artist|bmpx_bitrate|bmpx_title|bmpx_track|bmpx_uri|buffers|cached|color|colour|cpu|cpubar|diskio|downspeed|downspeedf|else|entropy_avail|entropy_bar|entropy_poolsize|exec|execbar|execgraph|execi|execibar|execigraph|font|freq|freq_dyn|freq_dyn_g|freq_g|fs_bar|fs_free|fs_free_perc|fs_size|fs_used|goto|hddtemp|head|hr|i2c|i8k_ac_status|i8k_bios|i8k_buttons_status|i8k_cpu_temp|i8k_cpu_tempf|i8k_left_fan_rpm|i8k_left_fan_status|i8k_right_fan_rpm|i8k_right_fan_status|i8k_serial|i8k_version|if_existing|if_running|if_mounted|kernel|linkstatus|loadavg|machine|mails|mem|membar|memmax|memperc|mpd_album|mpd_artist|mpd_bar|mpd_bitrate|mpd_elapsed|mpd_file|mpd_length|mpd_name|mpd_percent|mpd_smart|mpd_status|mpd_title|mpd_vol|new_mails|nodename|offset|outlinecolor|pre_exec|processes|running_processes|shadecolor|stippled_hr|swap|swapbar|swapmax|swapperc|sysname|tab|tail|tcp_portmon|texeci|time|top|top_mem|totaldown|totalup|tztime|updates|upspeed|upspeedf|upspeedgraph|uptime|uptime_short|voffset|voltage_mv|voltage_v)\>"
" Vim syntax file
-" Language: conkyrc
-" Author: Ciaran McCreesh <ciaranm@gentoo.org>
-" Version: 20060307
-" Copyright: Copyright (c) 2005 Ciaran McCreesh
-" Licence: You may redistribute this under the same terms as Vim itself
+" Language: conkyrc
+" Author: Ciaran McCreesh <ciaranm@gentoo.org>
+" Version: 20060307
+" Copyright: Copyright (c) 2005 Ciaran McCreesh
+" Licence: You may redistribute this under the same terms as Vim itself
"
" $Id$
\ default_color
\ default_outline_color
\ default_shade_color
+ \ dexter_client
+ \ dexter_config
+ \ dexter_server
\ double_buffer
\ draw_borders
\ draw_graph_borders
\ font
\ gap_x
\ gap_y
- \ imap
+ \ imap
\ mail_spool
- \ max_port_monitor_connections
- \ max_specials
- \ max_user_text
+ \ max_port_monitor_connections
+ \ max_specials
+ \ max_user_text
\ maximum_width
\ minimum_size
\ mpd_host
\ out_to_console
\ override_utf8_locale
\ own_window
+ \ own_window_class
\ own_window_colour
\ own_window_hints
+ \ own_window_title
\ own_window_transparent
- \ own_window_type
+ \ own_window_type
\ pad_percents
- \ pop3
+ \ pop3
\ stippled_borders
\ total_run_times
\ update_interval
\ below
\ bottom_left
\ bottom_right
- \ desktop
+ \ desktop
\ no
\ none
- \ normal
- \ override
+ \ normal
+ \ override
\ skip_pager
\ skip_taskbar
\ sticky
syn match ConkyrcVarStuff /{\@<=/ms=s contained nextgroup=ConkyrcVarName
syn keyword ConkyrcVarName contained nextgroup=ConkyrcNumber,ConkyrcColour skipwhite
- \ acpiacadapter
- \ acpifan
- \ acpitemp
- \ acpitempf
- \ addr
- \ adt746xcpu
- \ adt746xfan
- \ alignc
- \ alignr
- \ apm_adapter
- \ apm_battery_life
- \ apm_battery_time
- \ audacious_bar
+ \ acpiacadapter
+ \ acpifan
+ \ acpitemp
+ \ acpitempf
+ \ addr
+ \ adt746xcpu
+ \ adt746xfan
+ \ alignc
+ \ alignr
+ \ apm_adapter
+ \ apm_battery_life
+ \ apm_battery_time
+ \ audacious_bar
\ audacious_bitrate
\ audacious_channels
\ audacious_filename
\ audacious_position_seconds
\ audacious_status
\ audacious_title
- \ battery
- \ battery_time
- \ bmpx_album
- \ bmpx_artist
- \ bmpx_bitrate
- \ bmpx_title
- \ bmpx_track
- \ bmpx_uri
- \ buffers
- \ cached
- \ color
- \ colour
- \ cpu
- \ cpubar
- \ diskio
- \ downspeed
- \ downspeedf
- \ else
- \ entropy_avail
- \ entropy_bar
- \ entropy_poolsize
- \ exec
- \ execbar
- \ execgraph
- \ execi
- \ execibar
- \ execigraph
- \ font
- \ freq
- \ freq_dyn
- \ freq_dyn_g
- \ freq_g
- \ fs_bar
- \ fs_free
- \ fs_free_perc
- \ fs_size
- \ fs_used
- \ goto
- \ hddtemp
- \ head
- \ hr
- \ i2c
- \ i8k_ac_status
- \ i8k_bios
- \ i8k_buttons_status
- \ i8k_cpu_temp
- \ i8k_cpu_tempf
- \ i8k_left_fan_rpm
- \ i8k_left_fan_status
- \ i8k_right_fan_rpm
- \ i8k_right_fan_status
- \ i8k_serial
- \ i8k_version
- \ if_existing
- \ if_mounted
- \ if_running
- \ kernel
- \ linkstatus
- \ loadavg
- \ machine
- \ mails
- \ mem
- \ membar
- \ memmax
- \ memperc
- \ mpd_album
- \ mpd_artist
- \ mpd_bar
- \ mpd_bitrate
- \ mpd_elapsed
- \ mpd_file
- \ mpd_length
- \ mpd_name
- \ mpd_percent
- \ mpd_smart
- \ mpd_status
- \ mpd_title
- \ mpd_vol
- \ new_mails
- \ nodename
- \ offset
- \ outlinecolor
- \ pre_exec
- \ processes
- \ running_processes
- \ shadecolor
- \ stippled_hr
- \ swap
- \ swapbar
- \ swapmax
- \ swapperc
- \ sysname
- \ tab
- \ tail
- \ tcp_portmon
- \ texeci
- \ time
- \ top
- \ top_mem
- \ totaldown
- \ totalup
- \ tztime
- \ updates
- \ upspeed
- \ upspeedf
- \ upspeedgraph
- \ uptime
- \ uptime_short
- \ voffset
- \ voltage_mv
- \ voltage_v
+ \ battery
+ \ battery_time
+ \ bmpx_album
+ \ bmpx_artist
+ \ bmpx_bitrate
+ \ bmpx_title
+ \ bmpx_track
+ \ bmpx_uri
+ \ buffers
+ \ cached
+ \ color
+ \ colour
+ \ cpu
+ \ cpubar
+ \ diskio
+ \ downspeed
+ \ downspeedf
+ \ else
+ \ entropy_avail
+ \ entropy_bar
+ \ entropy_poolsize
+ \ exec
+ \ execbar
+ \ execgraph
+ \ execi
+ \ execibar
+ \ execigraph
+ \ font
+ \ freq
+ \ freq_dyn
+ \ freq_dyn_g
+ \ freq_g
+ \ fs_bar
+ \ fs_free
+ \ fs_free_perc
+ \ fs_size
+ \ fs_used
+ \ goto
+ \ hddtemp
+ \ head
+ \ hr
+ \ i2c
+ \ i8k_ac_status
+ \ i8k_bios
+ \ i8k_buttons_status
+ \ i8k_cpu_temp
+ \ i8k_cpu_tempf
+ \ i8k_left_fan_rpm
+ \ i8k_left_fan_status
+ \ i8k_right_fan_rpm
+ \ i8k_right_fan_status
+ \ i8k_serial
+ \ i8k_version
+ \ if_existing
+ \ if_mounted
+ \ if_running
+ \ kernel
+ \ linkstatus
+ \ loadavg
+ \ machine
+ \ mails
+ \ mem
+ \ membar
+ \ memmax
+ \ memperc
+ \ mpd_album
+ \ mpd_artist
+ \ mpd_bar
+ \ mpd_bitrate
+ \ mpd_elapsed
+ \ mpd_file
+ \ mpd_length
+ \ mpd_name
+ \ mpd_percent
+ \ mpd_smart
+ \ mpd_status
+ \ mpd_title
+ \ mpd_vol
+ \ new_mails
+ \ nodename
+ \ offset
+ \ outlinecolor
+ \ pre_exec
+ \ processes
+ \ running_processes
+ \ shadecolor
+ \ stippled_hr
+ \ swap
+ \ swapbar
+ \ swapmax
+ \ swapperc
+ \ sysname
+ \ tab
+ \ tail
+ \ tcp_portmon
+ \ texeci
+ \ time
+ \ top
+ \ top_mem
+ \ totaldown
+ \ totalup
+ \ tztime
+ \ updates
+ \ upspeed
+ \ upspeedf
+ \ upspeedgraph
+ \ uptime
+ \ uptime_short
+ \ voffset
+ \ voltage_mv
+ \ voltage_v
hi def link ConkyrcComment Comment
hi def link ConkyrcSetting Keyword
$(netbsd) \
$(port_monitors) \
$(solaris) \
- remotec.c \
- remotec.h \
- remoted.c \
- remoted.h \
timed_thread.c \
timed_thread.h \
$(x11) \
* ----------------------------------------- */
void update_audacious(void)
{
- /*
- The worker thread is updating audacious_items array asynchronously to the main
- conky thread. We merely copy the audacious_items array into the main thread's
- info structure when the main thread's update cycle fires.
- */
- if (!info.audacious.p_timed_thread)
- return;
-
- timed_thread_lock (info.audacious.p_timed_thread);
- memcpy(&info.audacious.items,audacious_items,sizeof(audacious_items));
- timed_thread_unlock (info.audacious.p_timed_thread);
+ /*
+ The worker thread is updating audacious_items array asynchronously to the main
+ conky thread. We merely copy the audacious_items array into the main thread's
+ info structure when the main thread's update cycle fires.
+ */
+ if (!info.audacious.p_timed_thread)
+ return;
+
+ timed_thread_lock (info.audacious.p_timed_thread);
+ memcpy(&info.audacious.items,audacious_items,sizeof(audacious_items));
+ timed_thread_unlock (info.audacious.p_timed_thread);
}
* ------------------------------------------------------------*/
int create_audacious_thread(void)
{
- if (!info.audacious.p_timed_thread)
- info.audacious.p_timed_thread = timed_thread_create (audacious_thread_func, NULL, 1000000);
+ if (!info.audacious.p_timed_thread)
+ info.audacious.p_timed_thread = timed_thread_create (audacious_thread_func, NULL, 1000000);
- if (!info.audacious.p_timed_thread)
- return (-1);
+ if (!info.audacious.p_timed_thread)
+ return (-1);
- return 0;
+ return 0;
}
/* ------------------------------------------------
* ------------------------------------------------ */
int destroy_audacious_thread(void)
{
- /* Is a worker is thread running? If not, no error. */
- if (!info.audacious.p_timed_thread)
- return(0);
+ /* Is a worker is thread running? If not, no error. */
+ if (!info.audacious.p_timed_thread)
+ return(0);
- timed_thread_destroy (info.audacious.p_timed_thread, &info.audacious.p_timed_thread);
+ timed_thread_destroy (info.audacious.p_timed_thread, &info.audacious.p_timed_thread);
- return 0;
+ return 0;
}
/* ---------------------------------------------------
* --------------------------------------------------- */
void *audacious_thread_func(void *pvoid)
{
- static audacious_t items;
- gint session,playpos,frames,length;
- gint rate,freq,chans;
- gchar *psong,*pfilename;
-
- pvoid=(void *)pvoid; /* avoid warning */
- session=0;
- psong=NULL;
- pfilename=NULL;
-
- /* Loop until the main thread sets the runnable signal to 0i via timed_thread_destroy. */
- while (1) {
-
- if (!xmms_remote_is_running (session)) {
- memset(&items,0,sizeof(items));
- strcpy(items[AUDACIOUS_STATUS],"Not running");
- goto next_iter;
- }
-
- /* Player status */
- if (xmms_remote_is_paused (session))
- strcpy(items[AUDACIOUS_STATUS],"Paused");
- else if (xmms_remote_is_playing (session))
- strcpy(items[AUDACIOUS_STATUS],"Playing");
- else
- strcpy(items[AUDACIOUS_STATUS],"Stopped");
-
- /* Current song title */
- playpos = xmms_remote_get_playlist_pos (session);
- psong = xmms_remote_get_playlist_title (session, playpos);
- if (psong) {
- strncpy(items[AUDACIOUS_TITLE],psong,sizeof(items[AUDACIOUS_TITLE])-1);
- g_free (psong);
- psong=NULL;
- }
-
- /* Current song length as MM:SS */
- frames = xmms_remote_get_playlist_time (session,playpos);
- length = frames / 1000;
- snprintf(items[AUDACIOUS_LENGTH],sizeof(items[AUDACIOUS_LENGTH])-1,
- "%d:%.2d", length / 60, length % 60);
-
- /* Current song length in seconds */
- snprintf(items[AUDACIOUS_LENGTH_SECONDS],sizeof(items[AUDACIOUS_LENGTH_SECONDS])-1,
- "%d", length);
-
- /* Current song position as MM:SS */
- frames = xmms_remote_get_output_time (session);
- length = frames / 1000;
- snprintf(items[AUDACIOUS_POSITION],sizeof(items[AUDACIOUS_POSITION])-1,
- "%d:%.2d", length / 60, length % 60);
-
- /* Current song position in seconds */
- snprintf(items[AUDACIOUS_POSITION_SECONDS],sizeof(items[AUDACIOUS_POSITION_SECONDS])-1,
- "%d", length);
-
- /* Current song bitrate */
- xmms_remote_get_info (session, &rate, &freq, &chans);
- snprintf(items[AUDACIOUS_BITRATE],sizeof(items[AUDACIOUS_BITRATE])-1, "%d", rate);
-
- /* Current song frequency */
- snprintf(items[AUDACIOUS_FREQUENCY],sizeof(items[AUDACIOUS_FREQUENCY])-1, "%d", freq);
-
- /* Current song channels */
- snprintf(items[AUDACIOUS_CHANNELS],sizeof(items[AUDACIOUS_CHANNELS])-1, "%d", chans);
-
- /* Current song filename */
- pfilename = xmms_remote_get_playlist_file (session,playpos);
- if (pfilename) {
- strncpy(items[AUDACIOUS_FILENAME],pfilename,sizeof(items[AUDACIOUS_FILENAME])-1);
- g_free (pfilename);
- pfilename=NULL;
- }
-
- /* Length of the Playlist (number of songs) */
- length = xmms_remote_get_playlist_length (session);
- snprintf(items[AUDACIOUS_PLAYLIST_LENGTH],sizeof(items[AUDACIOUS_PLAYLIST_LENGTH])-1, "%d", length);
-
- /* Playlist position (index of song) */
- snprintf(items[AUDACIOUS_PLAYLIST_POSITION],sizeof(items[AUDACIOUS_PLAYLIST_POSITION])-1,
- "%d", playpos+1);
+ static audacious_t items;
+ gint session,playpos,frames,length;
+ gint rate,freq,chans;
+ gchar *psong,*pfilename;
+
+ pvoid=(void *)pvoid; /* avoid warning */
+ session=0;
+ psong=NULL;
+ pfilename=NULL;
+
+ /* Loop until the main thread sets the runnable signal to 0i via timed_thread_destroy. */
+ while (1) {
+
+ if (!xmms_remote_is_running (session))
+ {
+ memset(&items,0,sizeof(items));
+ strcpy(items[AUDACIOUS_STATUS],"Not running");
+ goto next_iter;
+ }
-next_iter:
+ /* Player status */
+ if (xmms_remote_is_paused (session))
+ strcpy(items[AUDACIOUS_STATUS],"Paused");
+ else if (xmms_remote_is_playing (session))
+ strcpy(items[AUDACIOUS_STATUS],"Playing");
+ else
+ strcpy(items[AUDACIOUS_STATUS],"Stopped");
+
+ /* Current song title */
+ playpos = xmms_remote_get_playlist_pos (session);
+ psong = xmms_remote_get_playlist_title (session, playpos);
+ if (psong)
+ {
+ strncpy(items[AUDACIOUS_TITLE],psong,sizeof(items[AUDACIOUS_TITLE])-1);
+ g_free (psong);
+ psong=NULL;
+ }
+
+ /* Current song length as MM:SS */
+ frames = xmms_remote_get_playlist_time (session,playpos);
+ length = frames / 1000;
+ snprintf(items[AUDACIOUS_LENGTH],sizeof(items[AUDACIOUS_LENGTH])-1, "%d:%.2d", length / 60, length % 60);
+
+ /* Current song length in seconds */
+ snprintf(items[AUDACIOUS_LENGTH_SECONDS],sizeof(items[AUDACIOUS_LENGTH_SECONDS])-1, "%d", length);
+
+ /* Current song position as MM:SS */
+ frames = xmms_remote_get_output_time (session);
+ length = frames / 1000;
+ snprintf(items[AUDACIOUS_POSITION],sizeof(items[AUDACIOUS_POSITION])-1,
+ "%d:%.2d", length / 60, length % 60);
+
+ /* Current song position in seconds */
+ snprintf(items[AUDACIOUS_POSITION_SECONDS],sizeof(items[AUDACIOUS_POSITION_SECONDS])-1, "%d", length);
- /* Deliver the refreshed items array to audacious_items. */
- timed_thread_lock (info.audacious.p_timed_thread);
- memcpy(&audacious_items,items,sizeof(items));
- timed_thread_unlock (info.audacious.p_timed_thread);
+ /* Current song bitrate */
+ xmms_remote_get_info (session, &rate, &freq, &chans);
+ snprintf(items[AUDACIOUS_BITRATE],sizeof(items[AUDACIOUS_BITRATE])-1, "%d", rate);
- if (timed_thread_test (info.audacious.p_timed_thread))
- timed_thread_exit (info.audacious.p_timed_thread);
+ /* Current song frequency */
+ snprintf(items[AUDACIOUS_FREQUENCY],sizeof(items[AUDACIOUS_FREQUENCY])-1, "%d", freq);
+ /* Current song channels */
+ snprintf(items[AUDACIOUS_CHANNELS],sizeof(items[AUDACIOUS_CHANNELS])-1, "%d", chans);
+
+ /* Current song filename */
+ pfilename = xmms_remote_get_playlist_file (session,playpos);
+ if (pfilename)
+ {
+ strncpy(items[AUDACIOUS_FILENAME],pfilename,sizeof(items[AUDACIOUS_FILENAME])-1);
+ g_free (pfilename);
+ pfilename=NULL;
}
+
+ /* Length of the Playlist (number of songs) */
+ length = xmms_remote_get_playlist_length (session);
+ snprintf(items[AUDACIOUS_PLAYLIST_LENGTH],sizeof(items[AUDACIOUS_PLAYLIST_LENGTH])-1, "%d", length);
+
+ /* Playlist position (index of song) */
+ snprintf(items[AUDACIOUS_PLAYLIST_POSITION],sizeof(items[AUDACIOUS_PLAYLIST_POSITION])-1,
+ "%d", playpos+1);
+
+next_iter:
+
+ /* Deliver the refreshed items array to audacious_items. */
+ timed_thread_lock (info.audacious.p_timed_thread);
+ memcpy(&audacious_items,items,sizeof(items));
+ timed_thread_unlock (info.audacious.p_timed_thread);
+
+ if (timed_thread_test (info.audacious.p_timed_thread))
+ timed_thread_exit (info.audacious.p_timed_thread);
+ }
}
*/
#include "conky.h"
-#include "remoted.h"
-#include "remotec.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
return tv.tv_sec + (tv.tv_usec / 1000000.0);
}
+#if defined(HAVE_LIBDEXTER) && defined(__linux__)
+#define USE_OS_SPECIFIC_OPEN_FILE
+#endif
+
+#ifndef USE_OS_SPECIFIC_OPEN_FILE
FILE *open_file(const char *file, int *reported)
{
FILE *fp = fopen(file, "r");
return fp;
}
+#endif
void variable_substitute(const char *s, char *dest, unsigned int n)
{
return 0;
}
+void clear_net_stats (void)
+{
+ memset (netstats, 0, sizeof(netstats));
+}
+
void format_seconds(char *buf, unsigned int n, long t)
{
if (t >= 24 * 60 * 60) /* hours necessary when there are days? */
static double last_fs_update;
unsigned long long need_mask;
+#define NEED(a) ((need_mask & (1 << a)) && ((info.mask & (1 << a)) == 0))
void update_stuff()
{
}
prepare_update();
- /* client(); this is approximately where the client should be called */
-#define NEED(a) ((need_mask & (1 << a)) && ((info.mask & (1 << a)) == 0))
if (NEED(INFO_UPTIME))
update_uptime();
if (NEED(INFO_MAIL))
update_mail_count();
-
-
#if defined(__linux__)
if (NEED(INFO_I8K))
update_i8k();
#ifdef TCP_PORT_MONITOR
" * portmon\n"
#endif /* TCP_PORT_MONITOR */
+#ifdef HAVE_LIBDEXTER
+ " * network\n"
+#endif
"\n");
exit(0);
/* set to 1 if you want all text to be in uppercase */
static unsigned int stuff_in_upper_case;
-/* Update interval */
-static double update_interval;
-
/* Run how many times? */
static unsigned long total_run_times;
tcp_port_monitor_args_t tcp_port_monitor_args;
#endif
+#ifdef HAVE_LIBDEXTER
+/* private config items for libdexter */
+static char *dexter_config = NULL;
+#endif
+
/* Text that is shown */
static char original_text[] =
"$nodename - $sysname $kernel on $machine\n"
#ifdef TCP_PORT_MONITOR
OBJ_tcp_portmon,
#endif
-
#ifdef HAVE_ICONV
OBJ_iconv_start,
OBJ_iconv_stop,
OBJ(acpitemp, 0) obj->data.i = open_acpi_temperature(arg);
END OBJ(acpitempf, 0) obj->data.i = open_acpi_temperature(arg);
END OBJ(acpiacadapter, 0)
- END OBJ(freq, 0)
+ END OBJ(freq, INFO_FREQ)
get_cpu_count();
if (!arg
|| !isdigit(arg[0])
obj->data.cpu_index=atoi(&arg[0]);
}
obj->a = 1;
- END OBJ(freq_g, 0)
+ END OBJ(freq_g, INFO_FREQ)
get_cpu_count();
if (!arg
|| !isdigit(arg[0])
obj->data.cpu_index=atoi(&arg[0]);
}
obj->a = 1;
-#else
- END OBJ(freq, 0);
- END OBJ(freq_g, 0);
#endif /* __linux__ */
END OBJ(freq_dyn, 0);
END OBJ(freq_dyn_g, 0);
}
} else {
if (diskio_value > 1024*1024) {
- snprintf(p, 6, "%.1fGiB ",
+ snprintf(p, 12, "%.1fGiB ",
(double)diskio_value/1024/1024);
} else if (diskio_value > 1024) {
- snprintf(p, 6, "%.1fMiB ",
+ snprintf(p, 12, "%.1fMiB ",
(double)diskio_value/1024);
} else if (diskio_value > 0) {
- snprintf(p, 6, "%dKiB ", diskio_value);
+ snprintf(p, 12, "%dKiB ", diskio_value);
} else {
- snprintf(p, 6, "%dB ", diskio_value);
+ snprintf(p, 12, "%dB ", diskio_value);
}
}
}
recv_speed / 1024.0);
}
OBJ(downspeedgraph) {
- if (obj->data.net->recv_speed == 0) // this is just to make the ugliness at start go away
+ /*
+ if (obj->data.net->recv_speed == 0)
obj->data.net->recv_speed = 0.01;
+ */
new_graph(p, obj->a, obj->b, obj->c, obj->d,
(obj->data.net->recv_speed /
1024.0), obj->e, 1);
trans_speed / 1024.0);
}
OBJ(upspeedgraph) {
- if (obj->data.net->trans_speed == 0) // this is just to make the ugliness at start go away
+ /*
+ if (obj->data.net->trans_speed == 0)
obj->data.net->trans_speed = 0.01;
+ */
new_graph(p, obj->a, obj->b, obj->c, obj->d,
(obj->data.net->trans_speed /
1024.0), obj->e, 1);
printf("%s\n", s);
fflush(stdout); /* output immediately, don't buffer */
}
- /* daemon_run(s); the daemon can be called here, but we need to have a buffer in daemon_run() and we need to tell it when everything is ready to be sent */
memset(tmpstring1,0,TEXT_BUFFER_SIZE);
memset(tmpstring2,0,TEXT_BUFFER_SIZE);
strncpy(tmpstring1, s, TEXT_BUFFER_SIZE-1);
case ButtonPress:
if (own_window)
- {
+ {
+ /* if an ordinary window with decorations */
+ if ((window.type==TYPE_NORMAL) && (!TEST_HINT(window.hints,HINT_UNDECORATED)))
+ {
+ /* allow conky to hold input focus.*/
+ break;
+ }
+ else
+ {
/* forward the click to the desktop window */
XUngrabPointer(display, ev.xbutton.time);
ev.xbutton.window = window.desktop;
XSendEvent(display, ev.xbutton.window, False, ButtonPressMask, &ev);
- }
+ XSetInputFocus(display, ev.xbutton.window,RevertToParent,ev.xbutton.time);
+ }
+ }
break;
case ButtonRelease:
- if (own_window)
- {
- /* forward the release to the desktop window */
- ev.xbutton.window = window.desktop;
- XSendEvent(display, ev.xbutton.window, False, ButtonReleaseMask, &ev);
- }
- break;
+ if (own_window)
+ {
+ /* if an ordinary window with decorations */
+ if ((window.type==TYPE_NORMAL) && (!TEST_HINT(window.hints,HINT_UNDECORATED)))
+ {
+ /* allow conky to hold input focus.*/
+ break;
+ }
+ else
+ {
+ /* forward the release to the desktop window */
+ ev.xbutton.window = window.desktop;
+ XSendEvent(display, ev.xbutton.window, False, ButtonReleaseMask, &ev);
+ }
+ }
+ break;
#endif
free (specials);
specials=NULL;
}
+
+#ifdef HAVE_LIBDEXTER
+ dexter_library_exit ();
+ if (dexter_config)
+ free (dexter_config);
+#endif
}
static int string_to_bool(const char *s)
own_window = 0;
window.type=TYPE_NORMAL;
window.hints=0;
- strcpy(window.wm_class_name, "conky");
+ strcpy(window.class_name, "Conky");
+ update_uname();
+ sprintf(window.title,"%s - conky",info.uname_s.nodename);
#endif
stippled_borders = 0;
border_margin = 3;
#ifdef X11
#ifdef OWN_WINDOW
CONF("own_window") {
- own_window = string_to_bool(value);
- }
- CONF("wm_class_name") {
- memset(window.wm_class_name,0,sizeof(window.wm_class_name));
- strncpy(window.wm_class_name, value, sizeof(window.wm_class_name)-1);
- }
+ if (value)
+ own_window = string_to_bool(value);
+ else
+ CONF_ERR;
+ }
+ CONF("own_window_class") {
+ if (value)
+ {
+ memset(window.class_name,0,sizeof(window.class_name));
+ strncpy(window.class_name, value, sizeof(window.class_name)-1);
+ }
+ else
+ CONF_ERR;
+ }
+ CONF("own_window_title") {
+ if (value)
+ {
+ memset(window.title,0,sizeof(window.title));
+ strncpy(window.title, value, sizeof(window.title)-1);
+ }
+ else
+ CONF_ERR;
+ }
CONF("own_window_transparent") {
- set_transparent = string_to_bool(value);
+ if (value)
+ set_transparent = string_to_bool(value);
+ else
+ CONF_ERR;
}
CONF("own_window_colour") {
if (value) {
}
while (p_hint!=NULL);
}
+ else
+ CONF_ERR;
}
CONF("own_window_type") {
if (value) {
else if (strncmp(value,"override",8)==0)
window.type = TYPE_OVERRIDE;
else
- CONF_ERR;
+ CONF_ERR;
}
+ else
+ CONF_ERR;
}
#endif
CONF("stippled_borders") {
/* else tcp_port_monitor_args.max_port_monitor_connections > 0 as per config */
}
#endif
+#ifdef HAVE_LIBDEXTER
+ CONF("dexter_client")
+ {
+ if (value)
+ dexter_client = string_to_bool (value);
+ else
+ CONF_ERR;
+ }
+ CONF("dexter_server")
+ {
+ if (value)
+ dexter_server = string_to_bool (value);
+ else
+ CONF_ERR;
+ }
+ CONF("dexter_config")
+ {
+ if (value)
+ dexter_config = strdup (value);
+ else
+ CONF_ERR;
+ }
+#endif
else
ERR("%s: %d: no such configuration: '%s'", f, line, name);
}
}
- update_uname();
+#ifdef HAVE_LIBDEXTER
+ memset (&packet_arrival_time, 0, sizeof (struct timespec));
+ dexter_library_init ();
+ if (dexter_client)
+ {
+ /* wait until some data packets arrive, else conky complains
+ * bittery that /proc filesystems cannot be opened and, worse,
+ * will likely segfault when it references unchecked pointers
+ * in get_text_internal() -- those should be cleaned up.
+ */
+ int try;
+ const int max_tries=30;
+ gboolean got_packet;
+ GTimeVal timeval;
+ fprintf (stderr, "Conky: waiting for data packets to arrive ...\n");
+ for (try=0;try<max_tries;try++)
+ {
+ /* pause main thread for 1 sec */
+ g_get_current_time (&timeval);
+ g_time_val_add (&timeval, G_USEC_PER_SEC);
+ g_mutex_lock (packet_mutex);
+ /* mutex released before sleeping; re-acquired after time elapses */
+ g_cond_timed_wait (packet_cond, packet_mutex, &timeval);
+ got_packet = packet_arrival_time.tv_sec>0;
+ g_mutex_unlock (packet_mutex);
+
+ if (got_packet)
+ break;
+ }
+ if (got_packet)
+ {
+ fprintf(stderr, "Conky: packets arriving ...\n");
+ }
+ else
+ {
+ fprintf(stderr, "Conky: no data packets ...\n");
+ dexter_library_exit ();
+ exit(1);
+ }
+ }
+#endif
- generate_text();
#ifdef X11
selected_font = 0;
update_text_area(); /* to get initial size of the window */
(own_window,
text_width + border_margin * 2 + 1,
text_height + border_margin * 2 + 1,
- set_transparent, background_colour, info.uname_s.nodename, argv, argc);
+ set_transparent, background_colour, argv, argc);
selected_font = 0;
update_text_area(); /* to position text/window on screen */
timed_thread_register (info.audacious.p_timed_thread, &info.audacious.p_timed_thread);
#endif
- main_loop();
+ /*
+ * ***************
+ * MAIN CONKY LOOP
+ * ***************
+ *
+ */
+ main_loop();
#if defined(__FreeBSD__)
kvm_close(kd);
* and do any signal processing there, NOT here. */
g_signal_pending=sig;
}
+
+#ifdef HAVE_LIBDEXTER
+void dexter_library_init (void)
+{
+ /* start libdexter */
+ if (dexter_client || dexter_server)
+ {
+ GError *error = NULL;
+ dexter_init (dexter_config, &error);
+ if (error)
+ CRIT_ERR ("%s", error->message);
+
+ if (dexter_client)
+ {
+ if (!(info.dexter.channel = dexter_channel_new (NULL, NULL, NULL, dexter_channel_events)))
+ CRIT_ERR("unable to create channel to server");
+ dexter_channel_open (info.dexter.channel, &error);
+ if (error)
+ CRIT_ERR ("%s", error->message);
+ dexter_channel_greet (info.dexter.channel, &error);
+ if (error)
+ CRIT_ERR ("%s", error->message);
+ if (dexter_client_init () < 0)
+ CRIT_ERR ("error initializing dexter client");
+
+ packet_mutex = g_mutex_new ();
+ packet_cond = g_cond_new ();
+ }
+
+ if (dexter_server)
+ {
+ if (!(info.dexter.server = dexter_server_new (NULL, NULL, NULL)))
+ CRIT_ERR("unable to create server");
+ dexter_server_start (info.dexter.server, &error);
+ if (error)
+ CRIT_ERR ("%s", error->message);
+ }
+
+ }
+}
+
+void dexter_library_exit (void)
+{
+ /* shutdown libdexter */
+ if (dexter_client || dexter_server)
+ {
+ GError *error = NULL;
+
+ if (dexter_client)
+ {
+ if (dexter_client_exit () < 0)
+ ERR ("error de-initializing dexter client");
+ if (info.dexter.channel)
+ {
+ dexter_channel_part (info.dexter.channel, &error);
+ if (error)
+ {
+ ERR("%s", error->message);
+ g_clear_error (&error);
+ }
+ dexter_channel_close (info.dexter.channel, &error);
+ if (error)
+ {
+ ERR("%s", error->message);
+ g_clear_error (&error);
+ }
+ dexter_channel_free (info.dexter.channel);
+ info.dexter.channel=NULL;
+ }
+
+ if (packet_mutex)
+ {
+ g_mutex_free (packet_mutex);
+ packet_mutex=NULL;
+ }
+ if (packet_cond)
+ {
+ g_cond_free (packet_cond);
+ packet_cond=NULL;
+ }
+ }
+
+ if (dexter_server)
+ {
+ if (info.dexter.server)
+ {
+ dexter_server_stop (info.dexter.server, &error);
+ if (error)
+ {
+ ERR("%s", error->message);
+ g_clear_error (&error);
+ }
+ dexter_server_free (info.dexter.server);
+ info.dexter.server=NULL;
+ }
+ }
+
+ dexter_exit ();
+ }
+}
+
+void dexter_channel_events (DexterChannel *channel, gint event)
+{
+ if (!channel)
+ return;
+
+ /* if server disconnects we get this event. we also get it normally
+ * following dexter_channel_part(). */
+ if (event == DEXTER_CHANNEL_EVENT_NOCONN)
+ {
+ fprintf (stderr, "Conky: channel to server closed\n");
+ if (dexter_client && (dexter_client_exit () < 0))
+ ERR ("error de-initializing dexter client");
+ }
+}
+#endif
#include <machine/apm_bios.h>
#endif /* __FreeBSD__ */
+#ifdef HAVE_LIBDEXTER
+#include <dexter.h>
+#endif
+
#ifdef AUDACIOUS
#include "audacious.h"
#endif
#define MAX_PORT_MONITOR_CONNECTIONS_DEFAULT 256
#endif
+#ifdef HAVE_LIBDEXTER
+/* main start/stop for libdexter */
+void dexter_library_init (void);
+void dexter_library_exit (void);
+
+/* os-specific init/exit for libdexter client activity */
+int dexter_client_init (void);
+int dexter_client_exit (void);
+
+/* dexter channel events, i.e. we want to know if channel closes */
+void dexter_channel_events (DexterChannel *, gint);
+
+/* info struct for libdexter */
+struct dexter_s {
+ DexterChannel *channel;
+ DexterServer *server;
+ DexterServiceBroker *broker;
+};
+
+/* public config items for libdexter */
+int dexter_client;
+int dexter_server;
+
+/* data packet arrival time */
+struct timespec packet_arrival_time;
+GMutex *packet_mutex;
+GCond *packet_cond;
+#endif
+
enum {
INFO_CPU = 0,
INFO_MAIL = 1,
#include "libmpdclient.h"
#endif
+/* Update interval */
+double update_interval;
+
volatile int g_signal_pending;
struct information {
struct process *first_process;
unsigned long looped;
#ifdef TCP_PORT_MONITOR
- tcp_port_monitor_collection_t * p_tcp_port_monitor_collection;
+ tcp_port_monitor_collection_t * p_tcp_port_monitor_collection;
+#endif
+#ifdef HAVE_LIBDEXTER
+ struct dexter_s dexter;
#endif
short kflags; /* kernel settings, see enum KFLAG */
struct entropy_s entropy;
int width;
int height;
#ifdef OWN_WINDOW
- char wm_class_name[256];
+ char class_name[256];
+ char title[256];
int x;
int y;
unsigned int type;
extern struct conky_window window;
void init_X11();
-void init_window(int use_own_window, int width, int height, int set_trans, int back_colour, char * nodename,
- char **argv, int argc);
+void init_window(int use_own_window, int width, int height, int set_trans, int back_colour,
+ char **argv, int argc);
void create_gc();
void set_transparent_background(Window win);
long get_x11_color(const char *);
void format_seconds(char *buf, unsigned int n, long t);
void format_seconds_short(char *buf, unsigned int n, long t);
struct net_stat *get_net_stat(const char *dev);
+void clear_net_stats(void);
void update_stuff();
free_all_processes(void)
{
}
+
+#ifdef HAVE_LIBDEXTER
+/* return 0 on success, -1 on failure */
+int dexter_client_init (void)
+{
+ /* init libdexter for freebsd-specific client-side activity */
+ return 0;
+}
+
+/* return 0 on success, -1 on failure */
+int dexter_client_exit (void)
+{
+ /* de-init libdexter for freebsd-specific client-side activity */
+ return 0;
+}
+#endif
+
#define SHORTSTAT_TEMPL "%*s %llu %llu %llu"
#define LONGSTAT_TEMPL "%*s %llu %llu %llu "
-
-static struct sysinfo s_info;
+#ifdef HAVE_LIBDEXTER
+/* need the procraw service from the libdexter dxt-sysinfo plugin */
+#include <dxt-sysinfo/procraw-public.h>
+#define PROCRAW_SERVICE_UUID "ce975a10-0e52-458a-a4b9-253734760436"
+/* timed sampler that delivers the procraw data */
+static DexterTimedSampler *procraw_sampler = NULL;
+/* procraw structure used as /proc surrogate */
+static DxtSysinfoProcrawData procraw_data;
+/* data selector mask for the service */
+gint procraw_mask;
+#endif
static int show_nice_processes;
+/* this flags tells the linux routines to use the /proc system
+ * where possible, even if other api's are available, e.g. sysinfo()
+ * or getloadavg(). the reason for this is to allow for /proc-based
+ * distributed monitoring. using a flag in this manner creates less
+ * confusing code.
+ */
+static int prefer_proc = 0;
+
void prepare_update()
{
}
-static void update_sysinfo()
-{
- sysinfo(&s_info);
-
- info.uptime = (double) s_info.uptime;
-
- /* there was some problem with these */
-#if 0
-// info.loadavg[0] = s_info.loads[0] / 100000.0f;
- info.loadavg[1] = s_info.loads[1] / 100000.0f;
- info.loadavg[2] = s_info.loads[2] / 100000.0f;
- gkrelltop_process_find_top_three info.mask |= 1 << INFO_LOADAVG;
-#endif
-
- info.procs = s_info.procs;
-
- /* these aren't nice, no cache and should check kernel version for mem_unit */
-#if 0
- info.memmax = s_info.totalram;
- info.mem = s_info.totalram - s_info.freeram;
- info.swapmax = s_info.totalswap;
- info.swap = s_info.totalswap - s_info.swap;
- info.mask |= 1 << INFO_MEM;
-#endif
-
- info.mask |= (1 << INFO_UPTIME) | (1 << INFO_PROCS);
-}
-
void update_uptime()
{
- /* prefers sysinfo() for uptime, I don't really know which one is better
- * (=faster?) */
-#ifdef USE_PROC_UPTIME
- static int rep;
- FILE *fp = open_file("/proc/uptime", &rep);
- if (!fp)
- return 0;
- fscanf(fp, "%lf", &info.uptime);
- fclose(fp);
-
- info.mask |= (1 << INFO_UPTIME);
-#else
- update_sysinfo();
+#ifdef HAVE_SYSINFO
+ if (!prefer_proc)
+ {
+ struct sysinfo s_info;
+ sysinfo(&s_info);
+ info.uptime = (double) s_info.uptime;
+ }
+ else
#endif
+ {
+ static int rep = 0;
+ FILE *fp;
+
+ if (!(fp = open_file("/proc/uptime", &rep)))
+ {
+ return;
+ }
+ fscanf(fp, "%lf", &info.uptime);
+ fclose(fp);
+ }
+ info.mask |= (1 << INFO_UPTIME);
}
/* these things are also in sysinfo except Buffers:, that's why I'm reading
* them from proc */
-static FILE *meminfo_fp;
-
void update_meminfo()
{
- static int rep;
+ FILE *meminfo_fp;
+ static int rep = 0;
/* unsigned int a; */
char buf[256];
info.mem = info.memmax = info.swap = info.swapmax = info.bufmem =
info.buffers = info.cached = 0;
- if (meminfo_fp == NULL)
- meminfo_fp = open_file("/proc/meminfo", &rep);
- else
- fseek(meminfo_fp, 0, SEEK_SET);
- if (meminfo_fp == NULL)
- return;
+ if (!(meminfo_fp = open_file("/proc/meminfo", &rep)))
+ return;
while (!feof(meminfo_fp)) {
if (fgets(buf, 255, meminfo_fp) == NULL)
info.bufmem = info.cached + info.buffers;
info.mask |= (1 << INFO_MEM) | (1 << INFO_BUFFERS);
+
+ fclose (meminfo_fp);
}
-static FILE *net_dev_fp;
static FILE *net_wireless_fp;
inline void update_net_stats()
{
- static int rep;
+ FILE *net_dev_fp;
+ static int rep = 0;
// FIXME: arbitrary size chosen to keep code simple.
int i, i2;
unsigned int curtmp1, curtmp2;
unsigned int k;
struct ifconf conf;
-
-
char buf[256];
double delta;
return;
/* open file and ignore first two lines */
- if (net_dev_fp == NULL) {
- net_dev_fp = open_file("/proc/net/dev", &rep);
- }
- else
- fseek(net_dev_fp, 0, SEEK_SET);
- if (!net_dev_fp)
- return;
+ if (!(net_dev_fp = open_file("/proc/net/dev", &rep)))
+ return;
fgets(buf, 255, net_dev_fp); /* garbage */
fgets(buf, 255, net_dev_fp); /* garbage (field names) */
}
}
-
-
}
- /* fclose(net_dev_fp); net_dev_fp = NULL; */
+ fclose(net_dev_fp);
+
+ info.mask |= (1 << INFO_NET);
}
inline void update_wifi_stats()
{
/** wireless stats patch by Bobby Beckmann **/
- static int rep;
+ static int rep = 0;
int i;
char buf[256];
/*open file and ignore first two lines sorry, this code sucks ass right now, i'll clean it up later */
void update_total_processes()
{
- update_sysinfo();
+#ifdef HAVE_SYSINFO
+ if (!prefer_proc)
+ {
+ struct sysinfo s_info;
+ sysinfo(&s_info);
+ info.procs = s_info.procs;
+ }
+ else
+#endif
+ {
+ static int rep = 0;
+ FILE *fp;
+
+ if (!(fp = open_file("/proc/loadavg", &rep)))
+ {
+ return;
+ }
+ fscanf(fp, "%*f %*f %*f %*d/%hd", &info.procs );
+ fclose(fp);
+ }
+ info.mask |= (1 << INFO_PROCS);
}
#define CPU_SAMPLE_COUNT 15
double cpu_val[CPU_SAMPLE_COUNT];
};
static short cpu_setup = 0;
-static int rep;
-
-
-static FILE *stat_fp;
/*
determine if this kernel gives us "extended" statistics information in /proc/stat.
void get_cpu_count()
{
+ FILE *stat_fp;
+ static int rep = 0;
+
if (info.cpu_usage) {
return;
}
char buf[256];
- if (stat_fp == NULL)
- stat_fp = open_file("/proc/stat", &rep);
- else
- fseek(stat_fp, 0, SEEK_SET);
- if (stat_fp == NULL)
- return;
+
+ if (!(stat_fp = open_file("/proc/stat", &rep)))
+ return;
info.cpu_count = 0;
}
}
info.cpu_usage = malloc((info.cpu_count + 1) * sizeof(float));
+
+ fclose (stat_fp);
}
#define TMPL_LONGSTAT "%*s %llu %llu %llu %llu %llu %llu %llu %llu"
inline static void update_stat()
{
+ FILE *stat_fp;
+ static int rep = 0;
static struct cpu_info *cpu = NULL;
char buf[256];
unsigned int i;
cpu_setup = 1;
}
- if (stat_template == NULL) {
+ if (!stat_template) {
stat_template = KFLAG_ISSET(KFLAG_IS_LONGSTAT) ? TMPL_LONGSTAT : TMPL_SHORTSTAT ;
}
- if (cpu == NULL) {
- malloc_cpu_size = (info.cpu_count + 1) * sizeof(struct cpu_info);
+ if (!cpu) {
+ malloc_cpu_size = (info.cpu_count + 1) * sizeof(struct cpu_info);
cpu = malloc(malloc_cpu_size);
memset(cpu, 0, malloc_cpu_size);
}
- if (stat_fp == NULL) {
- stat_fp = open_file("/proc/stat", &rep);
- } else {
- fseek(stat_fp, 0, SEEK_SET);
- }
- if (stat_fp == NULL) {
- return;
- }
+ if (!(stat_fp = open_file("/proc/stat", &rep)))
+ return;
+
index = 0;
while (!feof(stat_fp)) {
if (fgets(buf, 255, stat_fp) == NULL)
info.mask |= (1 << INFO_CPU);
double delta = current_update_time - last_update_time;
- if (delta <= 0.001) return;
+ if (delta <= 0.001) break;
cpu[index].cpu_val[0] = (cpu[index].cpu_active_total - cpu[index].cpu_last_active_total) /
(float )(cpu[index].cpu_total - cpu[index].cpu_last_total);
}
}
+ fclose (stat_fp);
}
void update_running_processes()
void update_load_average()
{
#ifdef HAVE_GETLOADAVG
- double v[3];
- getloadavg(v, 3);
- info.loadavg[0] = (float) v[0];
- info.loadavg[1] = (float) v[1];
- info.loadavg[2] = (float) v[2];
-#else
- static int rep;
- FILE *fp;
-
- fp = open_file("/proc/loadavg", &rep);
- if (!fp) {
- v[0] = v[1] = v[2] = 0.0;
- return;
- }
-
- fscanf(fp, "%f %f %f", &info.loadavg[0], &info.loadavg[1],
- &info.loadavg[2]);
-
- fclose(fp);
+ if (!prefer_proc)
+ {
+ double v[3];
+ getloadavg(v, 3);
+ info.loadavg[0] = (float) v[0];
+ info.loadavg[1] = (float) v[1];
+ info.loadavg[2] = (float) v[2];
+ }
+ else
#endif
+ {
+ static int rep = 0;
+ FILE *fp;
+
+ if (!(fp = open_file("/proc/loadavg", &rep)))
+ {
+ info.loadavg[0] = info.loadavg[1] = info.loadavg[2] = 0.0;
+ return;
+ }
+ fscanf(fp, "%f %f %f", &info.loadavg[0], &info.loadavg[1], &info.loadavg[2]);
+ fclose(fp);
+ }
+ info.mask |= (1 << INFO_LOADAVG);
}
#define PROC_I8K "/proc/i8k"
/* if i2c device is NULL or *, get first */
if (dev == NULL || strcmp(dev, "*") == 0) {
- static int rep;
+ static int rep = 0;
if (!get_first_file_in_a_directory(I2C_DIR, buf, &rep))
return -1;
dev = buf;
void get_adt746x_fan( char * p_client_buffer, size_t client_buffer_size )
{
- static int rep;
+ static int rep = 0;
char adt746x_fan_state[64];
FILE *fp;
void get_adt746x_cpu( char * p_client_buffer, size_t client_buffer_size )
{
- static int rep;
+ static int rep = 0;
char adt746x_cpu_state[64];
FILE *fp;
char get_freq( char * p_client_buffer, size_t client_buffer_size, char * p_format, int divisor, unsigned int cpu )
{
FILE *f;
+ static int rep = 0;
char frequency[32];
char s[256];
double freq = 0;
- char current_freq_file[128];
- cpu--;
- snprintf(current_freq_file, 127, "%s/cpu%d/%s",
- CPUFREQ_PREFIX, cpu, CPUFREQ_POSTFIX);
-
if ( !p_client_buffer || client_buffer_size <= 0 || !p_format || divisor <= 0 )
return 0;
- f = fopen(current_freq_file, "r");
- if (f) {
- /* if there's a cpufreq /sys node, read the current frequency from this node;
- * divide by 1000 to get Mhz. */
- if (fgets(s, sizeof(s), f)) {
- s[strlen(s)-1] = '\0';
- freq = strtod(s, NULL);
- }
- fclose(f);
- snprintf( p_client_buffer, client_buffer_size, p_format, (freq/1000)/divisor );
- return 1;
+ if (!prefer_proc)
+ {
+ char current_freq_file[128];
+ snprintf(current_freq_file, 127, "%s/cpu%d/%s",CPUFREQ_PREFIX, cpu-1, CPUFREQ_POSTFIX);
+ f = fopen(current_freq_file, "r");
+ if (f)
+ {
+ /* if there's a cpufreq /sys node, read the current frequency from this node;
+ * divide by 1000 to get Mhz. */
+ if (fgets(s, sizeof(s), f)) {
+ s[strlen(s)-1] = '\0';
+ freq = strtod(s, NULL);
+ }
+ fclose(f);
+ snprintf( p_client_buffer, client_buffer_size, p_format, (freq/1000)/divisor );
+ return 1;
+ }
}
- cpu++;
- f = fopen("/proc/cpuinfo", "r"); //open the CPU information file
+ f = open_file("/proc/cpuinfo", &rep); //open the CPU information file
if (!f) {
perror("Conky: Failed to access '/proc/cpuinfo' at get_freq()");
return 0;
void get_acpi_fan( char * p_client_buffer, size_t client_buffer_size )
{
- static int rep;
+ static int rep = 0;
char buf[256];
char buf2[256];
FILE *fp;
void get_acpi_ac_adapter( char * p_client_buffer, size_t client_buffer_size )
{
- static int rep;
+ static int rep = 0;
char buf[256];
char buf2[256];
FILE *fp;
int fd;
if (name == NULL || strcmp(name, "*") == 0) {
- static int rep;
+ static int rep = 0;
if (!get_first_file_in_a_directory
(ACPI_THERMAL_DIR, buf, &rep))
return -1;
void get_battery_stuff(char *buf, unsigned int n, const char *bat, int item)
{
- static int rep, rep2;
+ static int rep = 0, rep2 = 0;
char acpi_path[128];
snprintf(acpi_path, 127, ACPI_BATTERY_BASE_PATH "/%s/state", bat);
/* read last full capacity if it's zero */
if (acpi_last_full == 0) {
- static int rep;
- char path[128];
+ static int rep = 0;
+ char path[128];
FILE *fp;
snprintf(path, 127,
ACPI_BATTERY_BASE_PATH "/%s/info", bat);
#define PMU_PATH "/proc/pmu"
void get_powerbook_batt_info(char *buf, size_t n, int i)
{
- static int rep;
+ static int rep = 0;
const char* batt_path = PMU_PATH "/battery_0";
const char* info_path = PMU_PATH "/info";
int flags, charge, max_charge, ac = -1;
void update_diskio()
{
static unsigned int last = UINT_MAX;
- static FILE* fp;
+ FILE* fp;
+ static int rep=0;
char buf[512];
int major, minor;
unsigned int reads, writes = 0;
int col_count = 0;
- if (!fp) {
- fp = fopen("/proc/diskstats", "r");
- } else {
- fseek(fp, 0, SEEK_SET);
- }
+ if (!(fp =open_file("/proc/diskstats", &rep)))
+ return;
/* read reads and writes from all disks (minor = 0), including
* cd-roms and floppies, and summ them up
last = current;
diskio_value = tot;
+
+ fclose(fp);
}
/* Here come the IBM ACPI-specific things. For reference, see
void update_entropy (void)
{
- static int rep;
- const char *entropy_avail = "/proc/sys/kernel/random/entropy_avail";
- const char *entropy_poolsize = "/proc/sys/kernel/random/poolsize";
- FILE *fp1, *fp2;
+ static int rep = 0;
+ const char *entropy_avail = "/proc/sys/kernel/random/entropy_avail";
+ const char *entropy_poolsize = "/proc/sys/kernel/random/poolsize";
+ FILE *fp1, *fp2;
- info.entropy.entropy_avail=0;
- info.entropy.poolsize=0;
+ info.entropy.entropy_avail=0;
+ info.entropy.poolsize=0;
- if ((fp1 = open_file (entropy_avail, &rep))==NULL)
- return;
+ if ((fp1 = open_file (entropy_avail, &rep))==NULL)
+ return;
+
+ if ((fp2 = open_file (entropy_poolsize, &rep))==NULL)
+ {
+ fclose (fp1);
+ return;
+ }
+
+ fscanf (fp1, "%u", &info.entropy.entropy_avail);
+ fscanf (fp2, "%u", &info.entropy.poolsize);
+
+ fclose (fp1);
+ fclose (fp2);
- if ((fp2 = open_file (entropy_poolsize, &rep))==NULL)
+ info.mask |= (1 << INFO_ENTROPY);
+}
+
+#ifdef HAVE_LIBDEXTER
+FILE *open_file(const char *file, int *reported)
+{
+ /* this version of open_file() is the hook that ties the client/server code
+ * into conky. if conky wants to open a /proc file that the server is feeding
+ * us, we do not return an ordinary file stream pointer to the local /proc
+ * filesystem. instead, we return a string stream pointer to the proc surrogate,
+ * so conky parses remote data as if it were local.
+ */
+ FILE *fp;
+
+ if ((strcmp (file,"/proc/cpuinfo")==0) && (procraw_mask & PROCRAW_CPUINFO))
+ {
+ if (!procraw_sampler)
+ return NULL;
+ fp = fmemopen (procraw_data.cpuinfo, procraw_data.cpuinfo_sz, "r");
+ }
+ else if ((strcmp (file,"/proc/loadavg")==0) && (procraw_mask & PROCRAW_LOADAVG))
+ {
+ if (!procraw_sampler)
+ return NULL;
+ fp = fmemopen (procraw_data.loadavg, procraw_data.loadavg_sz, "r");
+ }
+ else if ((strcmp (file,"/proc/meminfo")==0) && (procraw_mask & PROCRAW_MEMINFO))
+ {
+ if (!procraw_sampler)
+ return NULL;
+ fp = fmemopen (procraw_data.meminfo, procraw_data.meminfo_sz, "r");
+ }
+ else if ((strcmp (file,"/proc/stat")==0) && (procraw_mask & PROCRAW_STAT))
+ {
+ if (!procraw_sampler)
+ return NULL;
+ fp = fmemopen (procraw_data.stat, procraw_data.stat_sz, "r");
+ }
+ else if ((strcmp (file,"/proc/uptime")==0) && (procraw_mask & PROCRAW_UPTIME))
+ {
+ if (!procraw_sampler)
+ return NULL;
+ fp = fmemopen (procraw_data.uptime, procraw_data.uptime_sz, "r");
+ }
+ else if ((strcmp (file,"/proc/net/dev")==0) && (procraw_mask & PROCRAW_NET_DEV))
+ {
+ if (!procraw_sampler)
+ return NULL;
+ fp = fmemopen (procraw_data.net_dev, procraw_data.net_dev_sz, "r");
+ }
+ else if ((strcmp (file,"/proc/diskstats")==0) && (procraw_mask & PROCRAW_DISKSTATS))
+ {
+ if (!procraw_sampler)
+ return NULL;
+ fp = fmemopen (procraw_data.diskstats, procraw_data.diskstats_sz, "r");
+ }
+ else
+ {
+ fp = fopen(file, "r");
+ }
+
+ if (!fp)
+ {
+ if (!reported || *reported == 0)
{
- fclose (fp1);
- return;
+ ERR("can't open %s: %s", file, strerror(errno));
+ if (reported)
+ *reported = 1;
}
+ return 0;
+ }
+ return fp;
+}
- fscanf (fp1, "%u", &info.entropy.entropy_avail);
- fscanf (fp2, "%u", &info.entropy.poolsize);
+void sampler_data_callback (gpointer sampler, gpointer sampler_data)
+{
+ /* callback runs in a thread */
+ if (!sampler)
+ return;
- fclose (fp1);
- fclose (fp2);
+ if (sampler_data)
+ {
+ FILE *out;
+ char *p;
+ unsigned int i;
+ DxtSysinfoProcrawData *data = (DxtSysinfoProcrawData *)sampler_data;
+
+ /* use GNU string streams and stdio locking to exchange data with main thread. */
+
+ /* update /proc/cpuinfo surrogate */
+ for (;data->cpuinfo;)
+ {
+ if (!(out = open_memstream (&procraw_data.cpuinfo, &procraw_data.cpuinfo_sz)))
+ break;
+
+ flockfile (out);
+ if (procraw_data.cpuinfo)
+ {
+ free (procraw_data.cpuinfo); procraw_data.cpuinfo=NULL;
+ }
+ for (p=data->cpuinfo, i=0; i<data->cpuinfo_sz; i++, p++)
+ {
+ /* we have the FILE lock so use faster putc_unlocked() */
+ if (fputc_unlocked (*p, out) == EOF)
+ break;
+ }
+ fclose (out);
+ funlockfile (out);
+ break;
+ }
+
+ /* update /proc/loadavg surrogate */
+ for (;data->loadavg;)
+ {
+ if (!(out = open_memstream (&procraw_data.loadavg, &procraw_data.loadavg_sz)))
+ break;
+
+ flockfile (out);
+ if (procraw_data.loadavg)
+ {
+ free (procraw_data.loadavg); procraw_data.loadavg=NULL;
+ }
+ for (p=data->loadavg, i=0; i<data->loadavg_sz; i++, p++)
+ {
+ /* we have the FILE lock so use faster putc_unlocked() */
+ if (fputc_unlocked (*p, out) == EOF)
+ break;
+ }
+ fclose (out);
+ funlockfile (out);
+ break;
+ }
+
+ /* update /proc/meminfo surrogate */
+ for (;data->meminfo;)
+ {
+ if (!(out = open_memstream (&procraw_data.meminfo, &procraw_data.meminfo_sz)))
+ break;
+
+ flockfile (out);
+ if (procraw_data.meminfo)
+ {
+ free (procraw_data.meminfo); procraw_data.meminfo=NULL;
+ }
+ for (p=data->meminfo, i=0; i<data->meminfo_sz; i++, p++)
+ {
+ /* we have the FILE lock so use faster putc_unlocked() */
+ if (fputc_unlocked (*p, out) == EOF)
+ break;
+ }
+ fclose (out);
+ funlockfile (out);
+ break;
+ }
+
+ /* update /proc/stat surrogate */
+ for (;data->stat;)
+ {
+ if (!(out = open_memstream (&procraw_data.stat, &procraw_data.stat_sz)))
+ break;
+
+ flockfile (out);
+ if (procraw_data.stat)
+ {
+ free (procraw_data.stat); procraw_data.stat=NULL;
+ }
+ for (p=data->stat, i=0; i<data->stat_sz; i++, p++)
+ {
+ /* we have the FILE lock so use faster putc_unlocked() */
+ if (fputc_unlocked (*p, out) == EOF)
+ break;
+ }
+ fclose (out);
+ funlockfile (out);
+ break;
+ }
+
+ /* update /proc/uptime surrogate */
+ for (;data->uptime;)
+ {
+ if (!(out = open_memstream (&procraw_data.uptime, &procraw_data.uptime_sz)))
+ break;
+
+ flockfile (out);
+ if (procraw_data.uptime)
+ {
+ free (procraw_data.uptime); procraw_data.uptime=NULL;
+ }
+ for (p=data->uptime, i=0; i<data->uptime_sz; i++, p++)
+ {
+ /* we have the FILE lock so use faster putc_unlocked() */
+ if (fputc_unlocked (*p, out) == EOF)
+ break;
+ }
+ fclose (out);
+ funlockfile (out);
+ break;
+ }
+
+ /* update /proc/net/dev surrogate */
+ for (;data->net_dev;)
+ {
+ if (!(out = open_memstream (&procraw_data.net_dev, &procraw_data.net_dev_sz)))
+ break;
+
+ flockfile (out);
+ if (procraw_data.net_dev)
+ {
+ free (procraw_data.net_dev); procraw_data.net_dev=NULL;
+ }
+ for (p=data->net_dev, i=0; i<data->net_dev_sz; i++, p++)
+ {
+ /* we have the FILE lock so use faster putc_unlocked() */
+ if (fputc_unlocked (*p, out) == EOF)
+ break;
+ }
+ fclose (out);
+ funlockfile (out);
+ break;
+ }
+
+ /* update /proc/diskstats surrogate */
+ for (;data->diskstats;)
+ {
+ if (!(out = open_memstream (&procraw_data.diskstats, &procraw_data.diskstats_sz)))
+ break;
+
+ flockfile (out);
+ if (procraw_data.diskstats)
+ {
+ free (procraw_data.diskstats); procraw_data.diskstats=NULL;
+ }
+ for (p=data->diskstats, i=0; i<data->diskstats_sz; i++, p++)
+ {
+ /* we have the FILE lock so use faster putc_unlocked() */
+ if (fputc_unlocked (*p, out) == EOF)
+ break;
+ }
+ fclose (out);
+ funlockfile (out);
+ break;
+ }
+
+ /* record data packet arrival time */
+ g_mutex_lock (packet_mutex);
+ clock_gettime (CLOCK_REALTIME, &packet_arrival_time);
+ g_mutex_unlock (packet_mutex);
+#ifdef DEBUG
+ fprintf(stderr, "Conky: data packet arrived\n");
+#endif
+
+ } /* if (sampler_data) ... */
+}
+
+/* return 0 on success, -1 on failure */
+int dexter_client_init (void)
+{
+ /* init libdexter for linux-specific client-side activity */
+
+ DexterServiceBroker *broker;
+ DexterPluginServiceGroup *service_group;
+ DexterPluginService *procraw_service;
+ DexterSamplerDataCallback *callbacks;
+ GError *error = NULL;
+
+ /* create a service broker so we can query the server for its services */
+ if (!(broker = dexter_service_broker_new (info.dexter.channel)))
+ {
+ ERR ("unable to create service broker");
+ return (-1);
+ }
+
+ /* fetch the services from the server */
+ service_group = dexter_service_broker_get_services (broker, DEXTER_SERVICE_SAMPLER, &error);
+ if (error)
+ {
+ ERR("%s", error->message);
+ g_clear_error (&error);
+ dexter_service_broker_free (broker);
+ return (-1);
+ }
+
+ /* dont need service broker any more */
+ dexter_service_broker_free (broker);
+ broker=NULL;
+
+ /* find the procraw service */
+ procraw_service=NULL;
+ if (!dexterplugin_service_group_find_uuid (&procraw_service, service_group, PROCRAW_SERVICE_UUID))
+ {
+ ERR ("server doesn't offer the procraw service: (%s)", PROCRAW_SERVICE_UUID);
+ dexterplugin_service_group_free (service_group);
+ return (-1);
+ }
+
+ /* create null-terminated callback list with one callback on it */
+ callbacks = g_new0 (DexterSamplerDataCallback, 2);
+ callbacks[0] = sampler_data_callback;
+
+ /* create the procraw timed sampler, timed to match conky's update_interval */
+ procraw_sampler = dexter_timedsampler_new (procraw_service, update_interval*G_USEC_PER_SEC,
+ callbacks, info.dexter.channel, &error);
+ if (error)
+ {
+ ERR("%s", error->message);
+ g_clear_error (&error);
+ dexterplugin_service_group_free (service_group);
+ return (-1);
+ }
+
+ /* free callbacks as libdexter makes internal copy */
+ g_free (callbacks);
+ callbacks=NULL;
+
+ /* initialize the timed sampler */
+ procraw_mask = 0;
+ if (need_mask & (1 << INFO_FREQ))
+ procraw_mask |= PROCRAW_CPUINFO;
+ if (need_mask & (1 << INFO_LOADAVG))
+ procraw_mask |= PROCRAW_LOADAVG;
+ if ((need_mask & (1 << INFO_MEM)) || (need_mask & (1 << INFO_BUFFERS)))
+ procraw_mask |= PROCRAW_MEMINFO;
+ if ((need_mask & (1 << INFO_CPU)) || (need_mask & (1 << INFO_PROCS)) ||
+ (need_mask & (1 << INFO_RUN_PROCS)) || (need_mask & (1 << INFO_FREQ )))
+ procraw_mask |= PROCRAW_STAT;
+ if (need_mask & (1 << INFO_UPTIME))
+ procraw_mask |= PROCRAW_UPTIME;
+ if (need_mask & (1 << INFO_NET))
+ procraw_mask |= PROCRAW_NET_DEV;
+ if (need_mask & (1 << INFO_DISKIO))
+ procraw_mask |= PROCRAW_DISKSTATS;
+
+ dexter_timedsampler_initialize (procraw_sampler, &procraw_mask, NULL, &error);
+ if (error)
+ {
+ ERR("%s", error->message);
+ g_clear_error (&error);
+ dexter_timedsampler_free (procraw_sampler, NULL);
+ dexterplugin_service_group_free (service_group);
+ return (-1);
+ }
+
+ /* start the timed sampler and begin receiving updates from server */
+ dexter_timedsampler_start (procraw_sampler, &error);
+ if (error)
+ {
+ ERR("%s", error->message);
+ g_clear_error (&error);
+ dexter_timedsampler_free (procraw_sampler, NULL);
+ dexterplugin_service_group_free (service_group);
+ return (-1);
+ }
+
+ dexterplugin_service_group_free (service_group);
+
+ /* so far, so good. tell the linux routines to read /proc,
+ * even if other api's are available. */
+ prefer_proc = 1;
+
+ return 0;
}
+
+/* return 0 on success, -1 on failure */
+int dexter_client_exit (void)
+{
+ /* de-init libdexter for linux-specific client-side activity */
+
+ if (procraw_sampler)
+ {
+ dexter_timedsampler_stop (procraw_sampler, NULL);
+ dexter_timedsampler_free (procraw_sampler, NULL);
+ procraw_sampler=NULL;
+ }
+
+ /* free left-over sampler data. ok to do this without thread sync because
+ * this function runs in the same thread that conky issues open_file(). */
+ if (procraw_data.cpuinfo)
+ {
+ free (procraw_data.cpuinfo); procraw_data.cpuinfo=NULL;
+ }
+ if (procraw_data.loadavg)
+ {
+ free (procraw_data.loadavg); procraw_data.loadavg=NULL;
+ }
+ if (procraw_data.meminfo)
+ {
+ free (procraw_data.meminfo); procraw_data.meminfo=NULL;
+ }
+ if (procraw_data.stat)
+ {
+ free (procraw_data.stat); procraw_data.stat=NULL;
+ }
+ if (procraw_data.uptime)
+ {
+ free (procraw_data.uptime); procraw_data.uptime=NULL;
+ }
+ if (procraw_data.net_dev)
+ {
+ free (procraw_data.net_dev); procraw_data.net_dev=NULL;
+ }
+ if (procraw_data.diskstats)
+ {
+ free (procraw_data.diskstats); procraw_data.diskstats=NULL;
+ }
+
+ info.uptime=0.0;
+ info.procs=0;
+ info.mem = info.memmax = info.swap = info.swapmax = info.bufmem = info.buffers = info.cached = 0;
+ info.run_procs=0;
+ if (info.cpu_usage)
+ {
+ memset(info.cpu_usage, 0, info.cpu_count * sizeof (float));
+ }
+ clear_net_stats ();
+ diskio_value=0;
+ return 0;
+}
+#endif
void update_entropy (void)
{
}
+
+#ifdef HAVE_LIBDEXTER
+/* return 0 on success, -1 on failure */
+int dexter_client_init (void)
+{
+ /* init libdexter for netbsd-specific client-side activity */
+ return 0;
+}
+
+/* return 0 on success, -1 on failure */
+int dexter_client_exit (void)
+{
+ /* de-init libdexter for netbsd-specific client-side activity */
+ return 0;
+}
+#endif
+
+++ /dev/null
-/*
- * Conky, a system monitor, based on torsmo
- *
- * This program is licensed under BSD license, read COPYING
- *
- * $Id$
- */
-
- /*
-
- okay, nothing here right now. thanks for coming out
-
- */
-
-#include "conky.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <errno.h>
-#include <string.h>
-#include <netdb.h>
-#include <sys/types.h>
-#include <netinet/in.h>
-#include <sys/socket.h>
-
-#define PORT 3490 // the port client will be connecting to
-
-#define MAXDATASIZE 100 // max number of bytes we can get at once
-
-void client()
-{
- int sockfd, numbytes;
- char buf[MAXDATASIZE];
- struct hostent *he;
- struct sockaddr_in their_addr; // connector's address information
- if ((he=gethostbyname("localhost")) == NULL) { // get the host info
- perror("gethostbyname");
- exit(1);
- }
-
- if ((sockfd = socket(AF_INET, SOCK_STREAM, 0)) == -1) {
- perror("socket");
- exit(1);
- }
-
- their_addr.sin_family = AF_INET; // host byte order
- their_addr.sin_port = htons(PORT); // short, network byte order
- their_addr.sin_addr = *((struct in_addr *)he->h_addr);
- memset(&(their_addr.sin_zero), '\0', 8); // zero the rest of the struct
-
- if (connect(sockfd, (struct sockaddr *)&their_addr,
- sizeof(struct sockaddr)) == -1) {
- perror("connect");
- exit(1);
- }
-
- if ((numbytes=recv(sockfd, buf, MAXDATASIZE-1, 0)) == -1) {
- perror("recv");
- exit(1);
- }
-
- buf[numbytes] = '\0';
-
- printf("Received: %s",buf);
-
- close(sockfd);
-
- return;
-}
+++ /dev/null
-/*
- * Conky, a system monitor, based on torsmo
- *
- * This program is licensed under BSD license, read COPYING
- *
- * $Id$
- */
-
- /*
-
- okay, nothing here right now. thanks for coming out
-
- */
-
-void client();
+++ /dev/null
-/*
-* Conky, a system monitor, based on torsmo
-*
-* This program is licensed under BSD license, read COPYING
-*
-* $Id$
-*/
-
-#include <pthread.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <errno.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <sys/wait.h>
-#include <signal.h>
-
-static pthread_t daemon_thread;
-static int daemon_status = 0;
-static char *data;
-
-/* okay, heres how it will basically work.
-* when something connects, it will first send the conkyrc on the local (daemonized) server
-* after this, it will simply continue to send all the buffered text to the remote client
-* http://analyser.oli.tudelft.nl/beej/mirror/net/html/
-* http://www.kegel.com/c10k.html
-*/
-
-#define MYPORT 3490 // the port users will be connecting to
-
-#define BACKLOG 10 // how many pending connections queue will hold
-
-void sigchld_handler(/*int s*/)
-{
- while(wait(NULL) > 0);
-}
-
-void *daemon_loop()
-{
- /* do something */
-
-
-
- int sockfd, new_fd; // listen on sock_fd, new connection on new_fd
- struct sockaddr_in my_addr; // my address information
- struct sockaddr_in their_addr; // connector's address information
- socklen_t sin_size;
- struct sigaction sa;
- int yes=1;
-
- if ((sockfd = socket(AF_INET, SOCK_STREAM, 0)) == -1) {
- perror("socket");
- exit(1);
- }
-
- if (setsockopt(sockfd,SOL_SOCKET,SO_REUSEADDR,&yes,sizeof(int)) == -1) {
- perror("setsockopt");
- exit(1);
- }
-
- my_addr.sin_family = AF_INET; // host byte order
- my_addr.sin_port = htons(MYPORT); // short, network byte order
- my_addr.sin_addr.s_addr = INADDR_ANY; // automatically fill with my IP
- memset(&(my_addr.sin_zero), '\0', 8); // zero the rest of the struct
-
- if (bind(sockfd, (struct sockaddr *)&my_addr, sizeof(struct sockaddr))
- == -1) {
- perror("bind");
- exit(1);
- }
-
- if (listen(sockfd, BACKLOG) == -1) {
- perror("listen");
- exit(1);
- }
-
- sa.sa_handler = sigchld_handler; // reap all dead processes
- sigemptyset(&sa.sa_mask);
- sa.sa_flags = SA_RESTART;
- if (sigaction(SIGCHLD, &sa, NULL) == -1) {
- perror("sigaction");
- exit(1);
- }
-
- while(1) { // main accept() loop
- sin_size = sizeof(struct sockaddr_in);
- if ((new_fd = accept(sockfd, (struct sockaddr *)&their_addr,
- &sin_size)) == -1) {
- perror("accept");
- continue;
- }
- printf("server: got connection from %s\n",
- inet_ntoa(their_addr.sin_addr));
- if (!fork()) { // this is the child process
- close(sockfd); // child doesn't need the listener
- if (send(new_fd, data, 14, 0) == -1)
- perror("send");
- close(new_fd);
- exit(0);
- }
- close(new_fd); // parent doesn't need this
- }
-
- return 0;
-}
-
-void daemon_run(const char *s)
-{
- /* create thread, keep an eye on it */
- data = (char *)s;
- int iret;
- if (!daemon_status) {
- daemon_status = 1;
- iret = pthread_create(&daemon_thread, NULL, daemon_loop, NULL);
- } else if (daemon_status == 1) {
- /* thread is still running, we'll just wait for it to finish for now */
- pthread_join(daemon_thread, NULL);
- daemon_status = 0;
- } else {
- /* something else */
- }
-}
+++ /dev/null
-/*
- * Conky, a system monitor, based on torsmo
- *
- * This program is licensed under BSD license, read COPYING
- *
- * $Id$
- */
-
-#include "conky.h"
-
-void daemon_run(const char *s);
/* private */
struct _timed_thread
{
- pthread_t thread; /* thread itself */
- pthread_attr_t thread_attr; /* thread attributes */
- pthread_mutex_t cs_mutex; /* critical section mutex */
- pthread_mutex_t runnable_mutex; /* only for the runnable_cond */
- pthread_cond_t runnable_cond; /* signalled to stop the thread */
- unsigned int interval_usecs; /* timed_thread_test() wait interval in microseconds */
+ pthread_t thread; /* thread itself */
+ pthread_attr_t thread_attr; /* thread attributes */
+ pthread_mutex_t cs_mutex; /* critical section mutex */
+ pthread_mutex_t runnable_mutex; /* only for the runnable_cond */
+ pthread_cond_t runnable_cond; /* signalled to stop the thread */
+ unsigned int interval_usecs; /* timed_thread_test() wait interval in microseconds */
};
/* linked list of created threads */
typedef struct _timed_thread_list
{
- timed_thread *p_timed_thread;
- timed_thread **addr_of_p_timed_thread;
- struct _timed_thread_list *next;
+ timed_thread *p_timed_thread;
+ timed_thread **addr_of_p_timed_thread;
+ struct _timed_thread_list *next;
} timed_thread_node, timed_thread_list;
static timed_thread_list *p_timed_thread_list_head = NULL;
timed_thread*
timed_thread_create (void *(*start_routine)(void*), void *arg, unsigned int interval_usecs)
{
- timed_thread *p_timed_thread;
+ timed_thread *p_timed_thread;
- assert ((start_routine != NULL) && (interval_usecs >= MINIMUM_INTERVAL_USECS));
+ assert ((start_routine != NULL) && (interval_usecs >= MINIMUM_INTERVAL_USECS));
- if ((p_timed_thread = calloc (sizeof(timed_thread), 1)) == 0)
- return NULL;
+ if ((p_timed_thread = calloc (sizeof(timed_thread), 1)) == 0)
+ return NULL;
- /* init attributes, e.g. joinable thread */
- pthread_attr_init (&p_timed_thread->thread_attr);
- pthread_attr_setdetachstate (&p_timed_thread->thread_attr, PTHREAD_CREATE_JOINABLE);
- /* init mutexes */
- pthread_mutex_init (&p_timed_thread->cs_mutex, NULL);
- pthread_mutex_init (&p_timed_thread->runnable_mutex, NULL);
- /* init cond */
- pthread_cond_init (&p_timed_thread->runnable_cond, NULL);
+ /* init attributes, e.g. joinable thread */
+ pthread_attr_init (&p_timed_thread->thread_attr);
+ pthread_attr_setdetachstate (&p_timed_thread->thread_attr, PTHREAD_CREATE_JOINABLE);
+ /* init mutexes */
+ pthread_mutex_init (&p_timed_thread->cs_mutex, NULL);
+ pthread_mutex_init (&p_timed_thread->runnable_mutex, NULL);
+ /* init cond */
+ pthread_cond_init (&p_timed_thread->runnable_cond, NULL);
- p_timed_thread->interval_usecs = interval_usecs;
+ p_timed_thread->interval_usecs = interval_usecs;
- /* create thread */
- if (pthread_create (&p_timed_thread->thread, &p_timed_thread->thread_attr, start_routine, arg))
- {
- timed_thread_destroy (p_timed_thread, NULL);
- return NULL;
- }
+ /* create thread */
+ if (pthread_create (&p_timed_thread->thread, &p_timed_thread->thread_attr, start_routine, arg))
+ {
+ timed_thread_destroy (p_timed_thread, NULL);
+ return NULL;
+ }
- /*fprintf (stderr, "created timed thread 0x%08X\n", (unsigned)p_timed_thread);*/
- return p_timed_thread;
+ /*fprintf (stderr, "created timed thread 0x%08X\n", (unsigned)p_timed_thread);*/
+ return p_timed_thread;
}
void
timed_thread_destroy (timed_thread* p_timed_thread, timed_thread** addr_of_p_timed_thread)
{
- assert (p_timed_thread != NULL);
- assert ((addr_of_p_timed_thread == NULL) || (*addr_of_p_timed_thread == p_timed_thread));
-
- /* signal thread to stop */
- pthread_mutex_lock (&p_timed_thread->runnable_mutex);
- pthread_cond_signal (&p_timed_thread->runnable_cond);
- pthread_mutex_unlock (&p_timed_thread->runnable_mutex);
-
- /* join the terminating thread */
- pthread_join (p_timed_thread->thread, NULL);
-
- /* clean up */
- pthread_attr_destroy (&p_timed_thread->thread_attr);
- pthread_mutex_destroy (&p_timed_thread->cs_mutex);
- pthread_mutex_destroy (&p_timed_thread->runnable_mutex);
- pthread_cond_destroy (&p_timed_thread->runnable_cond);
-
- /*fprintf (stderr, "Conky: destroying thread 0x%08X\n", (unsigned)p_timed_thread);*/
- free (p_timed_thread);
- if (addr_of_p_timed_thread)
- *addr_of_p_timed_thread = NULL;
+ assert (p_timed_thread != NULL);
+ assert ((addr_of_p_timed_thread == NULL) || (*addr_of_p_timed_thread == p_timed_thread));
+
+ /* signal thread to stop */
+ pthread_mutex_lock (&p_timed_thread->runnable_mutex);
+ pthread_cond_signal (&p_timed_thread->runnable_cond);
+ pthread_mutex_unlock (&p_timed_thread->runnable_mutex);
+
+ /* join the terminating thread */
+ pthread_join (p_timed_thread->thread, NULL);
+
+ /* clean up */
+ pthread_attr_destroy (&p_timed_thread->thread_attr);
+ pthread_mutex_destroy (&p_timed_thread->cs_mutex);
+ pthread_mutex_destroy (&p_timed_thread->runnable_mutex);
+ pthread_cond_destroy (&p_timed_thread->runnable_cond);
+
+ /*fprintf (stderr, "Conky: destroying thread 0x%08X\n", (unsigned)p_timed_thread);*/
+ free (p_timed_thread);
+ if (addr_of_p_timed_thread)
+ *addr_of_p_timed_thread = NULL;
}
int
timed_thread_lock (timed_thread* p_timed_thread)
{
- assert (p_timed_thread != NULL);
+ assert (p_timed_thread != NULL);
- return pthread_mutex_lock (&p_timed_thread->cs_mutex);
+ return pthread_mutex_lock (&p_timed_thread->cs_mutex);
}
int
timed_thread_unlock (timed_thread* p_timed_thread)
{
- assert (p_timed_thread != NULL);
+ assert (p_timed_thread != NULL);
- return pthread_mutex_unlock (&p_timed_thread->cs_mutex);
+ return pthread_mutex_unlock (&p_timed_thread->cs_mutex);
}
int
timed_thread_test (timed_thread* p_timed_thread)
{
- struct timespec abstime, reltime;
- int rc;
-
- assert (p_timed_thread != NULL);
-
- /* acquire runnable_cond mutex */
- if (pthread_mutex_lock (&p_timed_thread->runnable_mutex))
- return (-1); /* could not acquire runnable_cond mutex, so tell caller to exit thread */
-
- /* get the absolute time in the future we stop waiting for condition to signal */
- clock_gettime (CLOCK_REALTIME, &abstime);
- /* seconds portion of the microseconds interval */
- reltime.tv_sec = (time_t)(p_timed_thread->interval_usecs / 1000000);
- /* remaining microseconds convert to nanoseconds */
- reltime.tv_nsec = (long)((p_timed_thread->interval_usecs % 1000000) * 1000);
- /* absolute future time */
- abstime.tv_sec += reltime.tv_sec;
- abstime.tv_nsec += reltime.tv_nsec;
-
- /* release mutex and wait until future time for runnable_cond to signal */
- rc = pthread_cond_timedwait (&p_timed_thread->runnable_cond,
- &p_timed_thread->runnable_mutex,
- &abstime);
- /* mutex re-acquired, so release it */
- pthread_mutex_unlock (&p_timed_thread->runnable_mutex);
-
- if (rc==0)
- return 1; /* runnable_cond was signaled, so tell caller to exit thread */
-
- /* tell caller not to exit yet */
- return 0;
+ struct timespec abstime, reltime;
+ int rc;
+
+ assert (p_timed_thread != NULL);
+
+ /* acquire runnable_cond mutex */
+ if (pthread_mutex_lock (&p_timed_thread->runnable_mutex))
+ return (-1); /* could not acquire runnable_cond mutex, so tell caller to exit thread */
+
+ /* get the absolute time in the future we stop waiting for condition to signal */
+ clock_gettime (CLOCK_REALTIME, &abstime);
+ /* seconds portion of the microseconds interval */
+ reltime.tv_sec = (time_t)(p_timed_thread->interval_usecs / 1000000);
+ /* remaining microseconds convert to nanoseconds */
+ reltime.tv_nsec = (long)((p_timed_thread->interval_usecs % 1000000) * 1000);
+ /* absolute future time */
+ abstime.tv_sec += reltime.tv_sec;
+ abstime.tv_nsec += reltime.tv_nsec;
+
+ /* release mutex and wait until future time for runnable_cond to signal */
+ rc = pthread_cond_timedwait (&p_timed_thread->runnable_cond,
+ &p_timed_thread->runnable_mutex,
+ &abstime);
+ /* mutex re-acquired, so release it */
+ pthread_mutex_unlock (&p_timed_thread->runnable_mutex);
+
+ if (rc==0)
+ return 1; /* runnable_cond was signaled, so tell caller to exit thread */
+
+ /* tell caller not to exit yet */
+ return 0;
}
void
timed_thread_exit (timed_thread* p_timed_thread)
{
- assert (p_timed_thread != NULL);
+ assert (p_timed_thread != NULL);
- pthread_exit (NULL);
+ pthread_exit (NULL);
}
int
timed_thread_register (timed_thread* p_timed_thread, timed_thread** addr_of_p_timed_thread)
{
- timed_thread_node *p_node;
-
- assert (p_timed_thread != NULL);
- assert ((addr_of_p_timed_thread == NULL) || (*addr_of_p_timed_thread == p_timed_thread));
+ timed_thread_node *p_node;
- if ((p_node = calloc (sizeof (timed_thread_node), 1)) == 0)
- return 0;
-
- p_node->p_timed_thread = p_timed_thread;
- p_node->addr_of_p_timed_thread = addr_of_p_timed_thread;
- p_node->next = NULL;
-
- if (!p_timed_thread_list_tail)
- {
- /* first node of empty list */
- p_timed_thread_list_tail = p_node;
- p_timed_thread_list_head = p_node;
- }
- else
- {
- /* add node to tail of non-empty list */
- p_timed_thread_list_tail->next = p_node;
- p_timed_thread_list_tail = p_node;
- }
+ assert (p_timed_thread != NULL);
+ assert ((addr_of_p_timed_thread == NULL) || (*addr_of_p_timed_thread == p_timed_thread));
+ if ((p_node = calloc (sizeof (timed_thread_node), 1)) == 0)
return 0;
+
+ p_node->p_timed_thread = p_timed_thread;
+ p_node->addr_of_p_timed_thread = addr_of_p_timed_thread;
+ p_node->next = NULL;
+
+ if (!p_timed_thread_list_tail)
+ {
+ /* first node of empty list */
+ p_timed_thread_list_tail = p_node;
+ p_timed_thread_list_head = p_node;
+ }
+ else
+ {
+ /* add node to tail of non-empty list */
+ p_timed_thread_list_tail->next = p_node;
+ p_timed_thread_list_tail = p_node;
+ }
+
+ return 0;
}
void
timed_thread_destroy_registered_threads (void)
{
- timed_thread_node *p_node, *p_next;
-
- for (p_node=p_timed_thread_list_head;
- p_node;
- p_node=p_next)
- {
- p_next = p_node->next;
- timed_thread_destroy (p_node->p_timed_thread, p_node->addr_of_p_timed_thread);
- free (p_node);
- p_node = NULL;
- }
-
- p_timed_thread_list_head = NULL;
- p_timed_thread_list_tail = NULL;
+ timed_thread_node *p_node, *p_next;
+
+ for (p_node=p_timed_thread_list_head;
+ p_node;
+ p_node=p_next)
+ {
+ p_next = p_node->next;
+ timed_thread_destroy (p_node->p_timed_thread, p_node->addr_of_p_timed_thread);
+ free (p_node);
+ p_node = NULL;
+ }
+
+ p_timed_thread_list_head = NULL;
+ p_timed_thread_list_tail = NULL;
}
int use_xft = 0;
#endif
-#define WINDOW_NAME_FMT "%s - conky"
-
/* some basic X11 stuff */
Display *display;
int display_width;
//XClearWindow(display, win); not sure why this was here
}
-void init_window(int own_window, int w, int h, int set_trans, int back_colour, char * nodename,
- char **argv, int argc)
+void init_window(int own_window, int w, int h, int set_trans, int back_colour,
+ char **argv, int argc)
{
/* There seems to be some problems with setting transparent background (on
* fluxbox this time). It doesn't happen always and I don't know why it
set_transparent = set_trans;
background_colour = back_colour;
- nodename = (char *)nodename;
-
#ifdef OWN_WINDOW
if (own_window) {
XClassHint classHint;
XWMHints wmHint;
Atom xa;
- char window_title[256];
/* Parent is root window so WM can take control */
window.window = XCreateWindow(display,
window.root,
- window.x, window.y, w, h, 0,
+ window.x, window.y, w, h, 0,
CopyFromParent,
InputOutput,
CopyFromParent,
CWBackPixel|CWOverrideRedirect,
&attrs);
- classHint.res_name = window.wm_class_name;
+ classHint.res_name = window.class_name;
classHint.res_class = classHint.res_name;
wmHint.flags = InputHint | StateHint;
- wmHint.input = False;
+ /* allow decorated windows to be given input focus by WM */
+ wmHint.input = TEST_HINT(window.hints,HINT_UNDECORATED) ? False : True;
wmHint.initial_state = NormalState;
- sprintf(window_title,WINDOW_NAME_FMT,nodename);
-
- XmbSetWMProperties (display, window.window, window_title, NULL,
+ XmbSetWMProperties (display, window.window, window.title, NULL,
argv, argc,
NULL, &wmHint, &classHint);