mirror of
https://github.com/Llewellynvdm/conky.git
synced 2024-12-23 19:39:06 +00:00
* Applied 12 patches:
1) sysfs battery support (for Linux >=2.6.24) (thanks Kapil) 2) Improved audacious support patch (thanks Miroslav) 3) tp_smapi support patch for IBM laptops (thanks Phil) 4) user info patch (thanks Roland) 5) added conky build info patch (thanks Roland) 6) added if_up patch (thanks Phil) 7) added reload on SIGHUP patch (thanks Jonas) 8) added pad percentages patch (thanks Jonas) 9) added fs_type patch (thanks Ryan) 10) added xmms2 fixes patch (thanks Lassi) 11) fix sysfs crash patch (thanks Phil) 12) multiple ip patch ($addrs) * Added more alignment support (top_middle, bottom_middle, middle_left, and middle_right). git-svn-id: https://conky.svn.sourceforge.net/svnroot/conky/trunk/conky1@1010 7f574dfc-610e-0410-a909-a81674777703
This commit is contained in:
parent
dd3b471f2d
commit
a1452f5db4
15
AUTHORS
15
AUTHORS
@ -135,6 +135,10 @@ Johannes Winkelmann <jw at tks6 dot net>
|
||||
jolapache <jolapache at free dot fr>
|
||||
maildir format
|
||||
|
||||
Jonas Koelker <jonaskoelker at users dot sourceforge dot net>
|
||||
reload on SIGHUP patch
|
||||
pad percantages fix patch
|
||||
|
||||
Joshua Gerrish <jgerrish at users dot sourceforge dot net>
|
||||
mpd password patch
|
||||
|
||||
@ -164,6 +168,7 @@ killfire
|
||||
|
||||
Lassi Selander <sleipner at users dot sourceforge dot net>
|
||||
XMMS2 patch
|
||||
XMMS2 fixes patch
|
||||
|
||||
Lauri Hakkarainen <b10nik at users dot sourceforge dot net>
|
||||
Some translating, web and other stuff
|
||||
@ -211,6 +216,9 @@ Philip Kovacs <pkovacs at users dot sourceforge dot net>
|
||||
|
||||
Phil <n0-1 at users dot sourceforge dot net>
|
||||
multiple batteries support
|
||||
tp_smapi support
|
||||
if_up patch
|
||||
fix sysfs crashing patch
|
||||
|
||||
Psychon <psychon at users dot sourceforge dot net>
|
||||
a bunch of code cleanups
|
||||
@ -218,9 +226,16 @@ Psychon <psychon at users dot sourceforge dot net>
|
||||
roiban adi <adiroiban at users dot sourceforge dot net>
|
||||
hex colour patch
|
||||
|
||||
Ryan Tandy <tarpman at users dot sourceforge dot net>
|
||||
fs_type patch
|
||||
|
||||
Rui Paulo <rpaulo at netbsd-pt dot org>
|
||||
NetBSD support
|
||||
|
||||
Roland Shoemaker <rolandshoemaker at users dot sourceforge dot net>
|
||||
user info patch
|
||||
conky version info patch
|
||||
|
||||
Roman Bogorodskiy <novel at clublife dot ru>
|
||||
FreeBSD support
|
||||
BMPx support
|
||||
|
14
ChangeLog
14
ChangeLog
@ -1,9 +1,21 @@
|
||||
# $Id$
|
||||
|
||||
2008-03-17
|
||||
* Applied 2 patches:
|
||||
* Applied 12 patches:
|
||||
1) sysfs battery support (for Linux >=2.6.24) (thanks Kapil)
|
||||
2) Improved audacious support patch (thanks Miroslav)
|
||||
3) tp_smapi support patch for IBM laptops (thanks Phil)
|
||||
4) user info patch (thanks Roland)
|
||||
5) added conky build info patch (thanks Roland)
|
||||
6) added if_up patch (thanks Phil)
|
||||
7) added reload on SIGHUP patch (thanks Jonas)
|
||||
8) added pad percentages patch (thanks Jonas)
|
||||
9) added fs_type patch (thanks Ryan)
|
||||
10) added xmms2 fixes patch (thanks Lassi)
|
||||
11) fix sysfs crash patch (thanks Phil)
|
||||
12) multiple ip patch ($addrs)
|
||||
* Added more alignment support (top_middle, bottom_middle, middle_left,
|
||||
and middle_right).
|
||||
|
||||
2008-02-08
|
||||
* Applied 2 patches:
|
||||
|
198
README
198
README
@ -39,7 +39,7 @@ COMPILING
|
||||
Example to compile and run Conky with all optional components (note
|
||||
that some configure options may differ for your system):
|
||||
|
||||
sh autogen.sh # Only required if building from Svn
|
||||
sh autogen.sh # Only required if building from SVN
|
||||
|
||||
./configure --prefix=/usr --mandir=/usr/share/man --in-
|
||||
fodir=/usr/share/info --datadir=/usr/share --sysconfdir=/etc --local-
|
||||
@ -75,14 +75,15 @@ YOU SHOULD KNOW
|
||||
unless you think something's seriously wrong (mem leak, etc.).
|
||||
|
||||
An easy way to force Conky to reload your ~/.conkyrc: "killall -SIGUSR1
|
||||
conky". Saves you the trouble of having to kill and then restart.
|
||||
conky". Saves you the trouble of having to kill and then restart. You
|
||||
can now also do the same with SIGHUP.
|
||||
|
||||
IMPORTANT: For previous Conky users, Conky 1.3 no longer supports the
|
||||
metar stuff. mdsplib was causing way too many problems. Hopefully
|
||||
IMPORTANT: For previous Conky users, Conky 1.3 no longer supports the
|
||||
metar stuff. mdsplib was causing way too many problems. Hopefully
|
||||
there'll be a better solution in Conky 2.x...
|
||||
|
||||
OPTIONS
|
||||
Command line options override configurations defined in configuration
|
||||
Command line options override configurations defined in configuration
|
||||
file.
|
||||
|
||||
-v | -V | --verbose
|
||||
@ -138,21 +139,23 @@ OPTIONS
|
||||
|
||||
|
||||
CONFIGURATION SETTINGS
|
||||
Default configuration file is $HOME/.conkyrc (can be changed from
|
||||
Default configuration file is $HOME/.conkyrc (can be changed from
|
||||
conky.c among other things). See conkyrc.sample. If installing from De-
|
||||
bian package, this should be in /usr/share/doc/conky/examples ("gunzip
|
||||
bian package, this should be in /usr/share/doc/conky/examples ("gunzip
|
||||
conkyrc.sample.gz" to get conkyrc.sample).
|
||||
|
||||
You might want to copy it to $HOME/.conkyrc and then start modifying
|
||||
You might want to copy it to $HOME/.conkyrc and then start modifying
|
||||
it. Other configs can be found at http://conky.sf.net
|
||||
|
||||
alignment
|
||||
Aligned position on screen, may be top_left, top_right, bot-
|
||||
tom_left, bottom_right, or none
|
||||
Aligned position on screen, may be top_left, top_right, top_mid-
|
||||
dle, bottom_left, bottom_right, bottom_middle, middle_left, mid-
|
||||
dle_right, or none (also can be abreviated as tl, tr, tm, bl,
|
||||
br, bm, ml, mr)
|
||||
|
||||
|
||||
background
|
||||
Boolean value, if true, Conky will be forked to background when
|
||||
Boolean value, if true, Conky will be forked to background when
|
||||
started
|
||||
|
||||
|
||||
@ -200,7 +203,7 @@ CONFIGURATION SETTINGS
|
||||
|
||||
top_cpu_separate
|
||||
If true, cpu in top will show usage of one processor's power. If
|
||||
false, cpu in top will show the usage of all processors' power
|
||||
false, cpu in top will show the usage of all processors' power
|
||||
combined.
|
||||
|
||||
|
||||
@ -241,18 +244,18 @@ CONFIGURATION SETTINGS
|
||||
font Font name in X, xfontsel can be used to get a nice font
|
||||
|
||||
|
||||
gap_x Gap, in pixels, between right or left border of screen, same as
|
||||
gap_x Gap, in pixels, between right or left border of screen, same as
|
||||
passing -x at command line, e.g. gap_x 10
|
||||
|
||||
|
||||
gap_y Gap, in pixels, between top or bottom border of screen, same as
|
||||
gap_y Gap, in pixels, between top or bottom border of screen, same as
|
||||
passing -y at command line, e.g. gap_y 10.
|
||||
|
||||
|
||||
imap Default global IMAP server. Arguments are: "host user pass [-i
|
||||
interval] [-f folder] [-p port] [-e command]". Default port is
|
||||
143, default folder is 'INBOX', default interval is 5 minutes.
|
||||
If the password is supplied as '*', you will be prompted to en-
|
||||
imap Default global IMAP server. Arguments are: "host user pass [-i
|
||||
interval] [-f folder] [-p port] [-e command]". Default port is
|
||||
143, default folder is 'INBOX', default interval is 5 minutes.
|
||||
If the password is supplied as '*', you will be prompted to en-
|
||||
ter the password when Conky starts.
|
||||
|
||||
|
||||
@ -261,12 +264,12 @@ CONFIGURATION SETTINGS
|
||||
|
||||
|
||||
max_port_monitor_connections
|
||||
Allow each port monitor to track at most this many connections
|
||||
Allow each port monitor to track at most this many connections
|
||||
(if 0 or not set, default is 256)
|
||||
|
||||
|
||||
max_specials
|
||||
Maximum number of special things, e.g. fonts, offsets, aligns,
|
||||
Maximum number of special things, e.g. fonts, offsets, aligns,
|
||||
etc. (default is 512)
|
||||
|
||||
|
||||
@ -300,7 +303,7 @@ CONFIGURATION SETTINGS
|
||||
|
||||
|
||||
music_player_interval
|
||||
Music player thread update interval (defaults to Conky's update
|
||||
Music player thread update interval (defaults to Conky's update
|
||||
interval)
|
||||
|
||||
|
||||
@ -325,21 +328,21 @@ CONFIGURATION SETTINGS
|
||||
|
||||
|
||||
own_window_colour colour
|
||||
If own_window_transparent no, set a specified background colour
|
||||
(defaults to black). Takes either a hex value (#ffffff) or a
|
||||
If own_window_transparent no, set a specified background colour
|
||||
(defaults to black). Takes either a hex value (#ffffff) or a
|
||||
valid RGB name (see /usr/lib/X11/rgb.txt)
|
||||
|
||||
|
||||
own_window_hints undecorated,below,above,sticky,skip_taskbar,skip_pager
|
||||
If own_window is yes, you may use these window manager hints to
|
||||
If own_window is yes, you may use these window manager hints to
|
||||
affect the way Conky displays. Notes: Use own_window_type desk-
|
||||
top as another way to implement many of these hints implicitly.
|
||||
If you use own_window_type override, window manager hints have
|
||||
top as another way to implement many of these hints implicitly.
|
||||
If you use own_window_type override, window manager hints have
|
||||
no meaning and are ignored.
|
||||
|
||||
|
||||
own_window_title
|
||||
Manually set the window name. Defaults to "<hostname> - conky".
|
||||
Manually set the window name. Defaults to "<hostname> - conky".
|
||||
|
||||
|
||||
own_window_transparent
|
||||
@ -347,11 +350,11 @@ CONFIGURATION SETTINGS
|
||||
|
||||
|
||||
own_window_type
|
||||
if own_window is yes, you may specify type normal, desktop or
|
||||
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-
|
||||
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.
|
||||
|
||||
@ -364,9 +367,9 @@ CONFIGURATION SETTINGS
|
||||
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.
|
||||
|
||||
|
||||
@ -380,7 +383,7 @@ CONFIGURATION SETTINGS
|
||||
|
||||
|
||||
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
|
||||
|
||||
|
||||
@ -395,8 +398,8 @@ CONFIGURATION SETTINGS
|
||||
use_spacer
|
||||
Adds spaces around certain objects to stop them from moving oth-
|
||||
er things around. Arguments are left, right, and none (default).
|
||||
The old true/false values are deprecated and default to
|
||||
right/none respectively. Note that this only helps if you are
|
||||
The old true/false values are deprecated and default to
|
||||
right/none respectively. Note that this only helps if you are
|
||||
using a mono font, such as Bitstream Vera Sans Mono.
|
||||
|
||||
|
||||
@ -416,16 +419,21 @@ CONFIGURATION SETTINGS
|
||||
|
||||
|
||||
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
|
||||
IP address for an interface
|
||||
|
||||
|
||||
addrs interface
|
||||
IP addresses for an interface (if one - works like addr). Linux
|
||||
only.
|
||||
|
||||
|
||||
acpiacadapter
|
||||
ACPI ac adapter state.
|
||||
|
||||
@ -609,6 +617,18 @@ VARIABLES
|
||||
color9 Change drawing color to color9 configuration option
|
||||
|
||||
|
||||
conky_version
|
||||
Conky version
|
||||
|
||||
|
||||
conky_build_date
|
||||
Date Conky was built
|
||||
|
||||
|
||||
conky_bulid_arch
|
||||
CPU architecture Conky was built for
|
||||
|
||||
|
||||
cpu (cpuN)
|
||||
CPU usage in percents. For SMP machines, the CPU number can be
|
||||
provided as an argument. ${cpu cpu0} is the total usage, and
|
||||
@ -763,6 +783,10 @@ VARIABLES
|
||||
File system size
|
||||
|
||||
|
||||
fs_type (fs)
|
||||
File system type
|
||||
|
||||
|
||||
fs_used (fs)
|
||||
File system used space
|
||||
|
||||
@ -919,11 +943,22 @@ VARIABLES
|
||||
and the matching $endif
|
||||
|
||||
|
||||
if_smapi_bat_installed (INDEX)
|
||||
when using smapi, if the battery with index INDEX is installed,
|
||||
display everything between $if_smapi_bat_installed and the
|
||||
matching $endif
|
||||
|
||||
|
||||
if_up (interface)
|
||||
if INTERFACE exists and is up, display everything between $if_up
|
||||
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.
|
||||
|
||||
@ -932,7 +967,7 @@ VARIABLES
|
||||
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.
|
||||
|
||||
@ -950,16 +985,16 @@ VARIABLES
|
||||
|
||||
|
||||
mails (mailbox) (interval)
|
||||
Mail count in the specified mailbox or your mail spool if not.
|
||||
Both mbox and maildir type mailboxes are supported. You can use
|
||||
a program like fetchmail to get mails from some server using
|
||||
Mail count in the specified mailbox or your mail spool if not.
|
||||
Both mbox and maildir type mailboxes are supported. You can use
|
||||
a program like fetchmail to get mails from some server using
|
||||
your favourite protocol. See also new_mails.
|
||||
|
||||
|
||||
mboxscan (-n number of messages to print) (-fw from width) (-sw subject
|
||||
width) mbox
|
||||
Print a summary of recent messages in an mbox format mailbox.
|
||||
mbox parameter is the filename of the mailbox (can be encapsu-
|
||||
Print a summary of recent messages in an mbox format mailbox.
|
||||
mbox parameter is the filename of the mailbox (can be encapsu-
|
||||
lated using '"', ie. ${mboxscan -n 10 "/home/brenden/some box"}
|
||||
|
||||
|
||||
@ -1057,26 +1092,26 @@ VARIABLES
|
||||
|
||||
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.
|
||||
|
||||
|
||||
platform (dev) type n
|
||||
Platform sensor from sysfs (Linux 2.6). Parameter dev may be
|
||||
omitted if you have only one platform device. Platform type is
|
||||
either 'in' or 'vol' meaning voltage; 'fan' meaning fan; 'temp'
|
||||
Platform sensor from sysfs (Linux 2.6). Parameter dev may be
|
||||
omitted if you have only one platform device. Platform type is
|
||||
either 'in' or 'vol' meaning voltage; 'fan' meaning fan; 'temp'
|
||||
(Celsius) or 'tempf' (Fahrenheit) meaning temperature. Parameter
|
||||
n is number of the sensor. See /sys/bus/platform/devices/ on
|
||||
n is number of the sensor. See /sys/bus/platform/devices/ on
|
||||
your local computer.
|
||||
|
||||
|
||||
@ -1084,17 +1119,17 @@ VARIABLES
|
||||
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.
|
||||
|
||||
@ -1116,6 +1151,25 @@ VARIABLES
|
||||
Change shading color
|
||||
|
||||
|
||||
smapi (ARGS)
|
||||
when using smapi, display contents of the /sys/devices/plat-
|
||||
form/smapi directory. ARGS are either '(FILENAME)' or 'bat (IN-
|
||||
DEX) (FILENAME)' to display the corresponding files' content.
|
||||
This is a very raw method of accessing the smapi values. When
|
||||
available, better use one of the smapi_* variables instead.
|
||||
|
||||
|
||||
smapi_bat_perc (INDEX)
|
||||
when using smapi, display the remaining capacity in percent of
|
||||
the battery with index INDEX. This is a separate variable be-
|
||||
cause it supports the 'use_spacer' configuration option.
|
||||
|
||||
|
||||
smapi_bat_bar (INDEX),(height),(width)
|
||||
when using smapi, display the remaining capacity of the battery
|
||||
with index INDEX as a bar.
|
||||
|
||||
|
||||
stippled_hr (space)
|
||||
Stippled (dashed) horizontal line
|
||||
|
||||
@ -1272,6 +1326,22 @@ VARIABLES
|
||||
Uptime in a shorter format
|
||||
|
||||
|
||||
user_number
|
||||
Number of users logged in
|
||||
|
||||
|
||||
user_names
|
||||
Lists the names of the users logged in
|
||||
|
||||
|
||||
user_terms
|
||||
Lists the consoles in use
|
||||
|
||||
|
||||
user_times
|
||||
Lists how long users have been logged in for
|
||||
|
||||
|
||||
voffset (pixels)
|
||||
Change vertical offset by N pixels. Negative values will cause
|
||||
text to overlap. See also $offset.
|
||||
|
@ -1,9 +1,9 @@
|
||||
THESE INSTRUCTIONS ARE ONLY IF "sh autogen.sh" DOESN'T WORK!!!
|
||||
|
||||
First, read the README. This contains instructions specific to building conky
|
||||
fresh from a CVS checkout:
|
||||
Fresh from a SVN checkout:
|
||||
|
||||
* As the README says, you need to have the X development libraries installed.
|
||||
* As the README says, you need to have the X development libraries installed.
|
||||
This should be a package along the lines of libx11-dev or xorg-x11-dev .
|
||||
* Conky requires three "auto-tools", with at least the specific version numbers.
|
||||
Make sure these are installed:
|
||||
@ -12,7 +12,7 @@ fresh from a CVS checkout:
|
||||
automake-1.9
|
||||
autoconf-2.59
|
||||
|
||||
* In the directory where you checked out conky from CVS,
|
||||
* In the directory where you checked out conky from SVN,
|
||||
run "aclocal", "automake", and then "autoconf".
|
||||
Make sure you run those commands with the latest versions...
|
||||
it is very possible that older versions are installed, and
|
@ -219,6 +219,19 @@ if test x$want_rss = xyes; then
|
||||
AC_DEFINE(RSS, 1, [Define if you want rss support])
|
||||
fi
|
||||
|
||||
dnl
|
||||
dnl SMAPI
|
||||
dnl
|
||||
|
||||
AC_ARG_ENABLE([smapi],
|
||||
AC_HELP_STRING([--enable-smapi], [enable if you want smapi support @<:@default=no@:>@]),
|
||||
[want_smapi="$enableval"], [want_smapi=no])
|
||||
|
||||
AM_CONDITIONAL(BUILD_SMAPI, test x$want_smapi = xyes)
|
||||
if test x$want_smapi = xyes; then
|
||||
AC_DEFINE(SMAPI, 1, [Define if you want smapi support])
|
||||
fi
|
||||
|
||||
dnl
|
||||
dnl Wireless extensions
|
||||
dnl
|
||||
@ -474,6 +487,14 @@ AC_SEARCH_LIBS(clock_gettime, [rt],
|
||||
[AC_DEFINE(HAVE_CLOCK_GETTIME, 1, [Define if you have clock_gettime()])],
|
||||
[AC_CHECK_FUNCS([gettimeofday], [], [AC_MSG_ERROR([gettimeofday() not available!])])], [])
|
||||
|
||||
dnl
|
||||
dnl Structure checks
|
||||
dnl
|
||||
|
||||
AC_CHECK_MEMBER([struct statfs.f_fstypename],
|
||||
[AC_DEFINE(HAVE_STRUCT_STATFS_F_FSTYPENAME, 1, [Define if struct statfs has the f_fstypename member])],
|
||||
[],
|
||||
[#include <sys/statfs.h>])
|
||||
|
||||
dnl
|
||||
dnl Check for zlib
|
||||
@ -583,4 +604,5 @@ $PACKAGE $VERSION configured successfully:
|
||||
portmon: $want_portmon
|
||||
rss: $want_rss
|
||||
wireless: $want_wlan
|
||||
smapi: $want_smapi
|
||||
EOF
|
||||
|
@ -2,7 +2,7 @@
|
||||
<varlistentry>
|
||||
<term><command><option>alignment</option></command></term>
|
||||
<listitem>
|
||||
Aligned position on screen, may be top_left, top_right, bottom_left, bottom_right, or none
|
||||
Aligned position on screen, may be top_left, top_right, top_middle, bottom_left, bottom_right, bottom_middle, middle_left, middle_right, or none (also can be abreviated as tl, tr, tm, bl, br, bm, ml, mr)
|
||||
<para></para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
|
1044
doc/conky.1
1044
doc/conky.1
File diff suppressed because it is too large
Load Diff
@ -74,7 +74,7 @@
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<command><option>sh autogen.sh</option></command> <option># Only required if building from Svn</option>
|
||||
<command><option>sh autogen.sh</option></command> <option># Only required if building from SVN</option>
|
||||
</term>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
@ -129,7 +129,7 @@
|
||||
</para>
|
||||
<para>
|
||||
An easy way to force Conky to reload your ~/.conkyrc: "killall -SIGUSR1 conky".
|
||||
Saves you the trouble of having to kill and then restart.
|
||||
Saves you the trouble of having to kill and then restart. You can now also do the same with SIGHUP.
|
||||
</para>
|
||||
<para>
|
||||
IMPORTANT: For previous Conky users, Conky 1.3 no longer supports the metar stuff.
|
||||
|
@ -9,6 +9,17 @@
|
||||
<para></para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>
|
||||
<command><option>addrs</option></command>
|
||||
<option>interface</option>
|
||||
</term>
|
||||
<listitem>
|
||||
IP addresses for an interface (if one - works like addr). Linux only.
|
||||
<para></para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
|
||||
<varlistentry>
|
||||
<term>
|
||||
<command><option>acpiacadapter</option></command>
|
||||
@ -442,6 +453,33 @@
|
||||
<para></para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>
|
||||
<command><option>conky_version</option></command>
|
||||
</term>
|
||||
<listitem>
|
||||
Conky version
|
||||
<para></para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>
|
||||
<command><option>conky_build_date</option></command>
|
||||
</term>
|
||||
<listitem>
|
||||
Date Conky was built
|
||||
<para></para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>
|
||||
<command><option>conky_bulid_arch</option></command>
|
||||
</term>
|
||||
<listitem>
|
||||
CPU architecture Conky was built for
|
||||
<para></para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>
|
||||
<command><option>cpu</option></command>
|
||||
@ -751,6 +789,16 @@
|
||||
<para></para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>
|
||||
<command><option>fs_type</option></command>
|
||||
<option>(fs)</option>
|
||||
</term>
|
||||
<listitem>
|
||||
File system type
|
||||
<para></para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>
|
||||
<command><option>fs_used</option></command>
|
||||
@ -1033,6 +1081,26 @@
|
||||
<para></para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>
|
||||
<command><option>if_smapi_bat_installed</option></command>
|
||||
<option>(INDEX)</option>
|
||||
</term>
|
||||
<listitem>
|
||||
when using smapi, if the battery with index INDEX is installed, display everything between $if_smapi_bat_installed and the matching $endif
|
||||
<para></para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>
|
||||
<command><option>if_up</option></command>
|
||||
<option>(interface)</option>
|
||||
</term>
|
||||
<listitem>
|
||||
if INTERFACE exists and is up, display everything between $if_up and the matching $endif
|
||||
<para></para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>
|
||||
<command><option>imap_messages</option></command>
|
||||
@ -1420,6 +1488,36 @@
|
||||
<para></para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>
|
||||
<command><option>smapi</option></command>
|
||||
<option>(ARGS)</option>
|
||||
</term>
|
||||
<listitem>
|
||||
when using smapi, display contents of the /sys/devices/platform/smapi directory. ARGS are either '(FILENAME)' or 'bat (INDEX) (FILENAME)' to display the corresponding files' content. This is a very raw method of accessing the smapi values. When available, better use one of the smapi_* variables instead.
|
||||
<para></para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>
|
||||
<command><option>smapi_bat_perc</option></command>
|
||||
<option>(INDEX)</option>
|
||||
</term>
|
||||
<listitem>
|
||||
when using smapi, display the remaining capacity in percent of the battery with index INDEX. This is a separate variable because it supports the 'use_spacer' configuration option.
|
||||
<para></para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>
|
||||
<command><option>smapi_bat_bar</option></command>
|
||||
<option>(INDEX),(height),(width)</option>
|
||||
</term>
|
||||
<listitem>
|
||||
when using smapi, display the remaining capacity of the battery with index INDEX as a bar.
|
||||
<para></para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>
|
||||
<command><option>stippled_hr</option></command>
|
||||
@ -1700,6 +1798,42 @@
|
||||
<para></para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>
|
||||
<command><option>user_number</option></command>
|
||||
</term>
|
||||
<listitem>
|
||||
Number of users logged in
|
||||
<para></para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>
|
||||
<command><option>user_names</option></command>
|
||||
</term>
|
||||
<listitem>
|
||||
Lists the names of the users logged in
|
||||
<para></para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>
|
||||
<command><option>user_terms</option></command>
|
||||
</term>
|
||||
<listitem>
|
||||
Lists the consoles in use
|
||||
<para></para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>
|
||||
<command><option>user_times</option></command>
|
||||
</term>
|
||||
<listitem>
|
||||
Lists how long users have been logged in for
|
||||
<para></para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>
|
||||
<command><option>voffset</option></command>
|
||||
@ -1741,7 +1875,7 @@
|
||||
</term>
|
||||
<listitem>
|
||||
Wireless access point ESSID (Linux only)
|
||||
<para></para></listitem>
|
||||
<para></para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
@ -1751,7 +1885,7 @@
|
||||
</term>
|
||||
<listitem>
|
||||
Wireless mode (Managed/Ad-Hoc/Master) (Linux only)
|
||||
<para></para></listitem>
|
||||
<para></para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
@ -1761,7 +1895,7 @@
|
||||
</term>
|
||||
<listitem>
|
||||
Wireless bitrate (ie 11 Mb/s) (Linux only)
|
||||
<para></para></listitem>
|
||||
<para></para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
|
@ -9,7 +9,7 @@ syntax "conky" "\.*conkyrc.*$"
|
||||
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|music_player_interval|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|cpugraph|diskio|diskiograph|downspeed|downspeedf|downspeedgraph|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|hwmon|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|platform|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)\>"
|
||||
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|cpugraph|diskio|diskiograph|downspeed|downspeedf|downspeedgraph|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|hwmon|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|platform|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|xmms2_artist|xmms2_album|xmms2_title|xmms2_genre|xmms2_comment|xmms2_url|xmms2_tracknr|xmms2_bitrate|xmms2_id|xmms2_duration|xmms2_elapsed|xmms2_size|xmms2_percent|xmms2_status|xmms2_bar|xmms2_smart|xmms2_date|xmms2_timesplayed|xmms2_playlist)\>"
|
||||
color brightblue "\$\{?[0-9A-Z_!@#$*?-]+\}?"
|
||||
color cyan "(\{|\}|\(|\)|\;|\]|\[|`|\\|\$|<|>|!|=|&|\|)"
|
||||
color brightred "^TEXT$"
|
||||
|
@ -236,6 +236,25 @@ syn keyword ConkyrcVarName contained nextgroup=ConkyrcNumber,ConkyrcColour skipw
|
||||
\ voffset
|
||||
\ voltage_mv
|
||||
\ voltage_v
|
||||
\ xmms2_artist
|
||||
\ xmms2_album
|
||||
\ xmms2_title
|
||||
\ xmms2_genre
|
||||
\ xmms2_comment
|
||||
\ xmms2_url
|
||||
\ xmms2_tracknr
|
||||
\ xmms2_bitrate
|
||||
\ xmms2_id
|
||||
\ xmms2_duration
|
||||
\ xmms2_elapsed
|
||||
\ xmms2_date
|
||||
\ xmms2_size
|
||||
\ xmms2_percent
|
||||
\ xmms2_status
|
||||
\ xmms2_bar
|
||||
\ xmms2_timesplayed
|
||||
\ xmms2_playlist
|
||||
\ xmms2_smart
|
||||
|
||||
hi def link ConkyrcComment Comment
|
||||
hi def link ConkyrcSetting Keyword
|
||||
|
@ -84,6 +84,10 @@ if BUILD_RSS
|
||||
rss = rss.c prss.c prss.h
|
||||
endif
|
||||
|
||||
if BUILD_SMAPI
|
||||
smapi = smapi.c smapi.h
|
||||
endif
|
||||
|
||||
conky_SOURCES = \
|
||||
$(audacious) \
|
||||
$(bmpx) \
|
||||
@ -107,7 +111,9 @@ conky_SOURCES = \
|
||||
mboxscan.c \
|
||||
mboxscan.h \
|
||||
$(x11) \
|
||||
$(xmms2)
|
||||
$(xmms2) \
|
||||
$(smapi) \
|
||||
users.c
|
||||
|
||||
AM_LDFLAGS = $(PTHREAD_LIBS) -lm
|
||||
|
||||
@ -129,6 +135,8 @@ EXTRA_DIST = \
|
||||
top.h \
|
||||
diskio.h \
|
||||
x11.c \
|
||||
xmms2.c
|
||||
xmms2.c \
|
||||
smapi.c \
|
||||
users.c
|
||||
|
||||
# vi:set ts=8 sw=8 noet ai nocindent syntax=automake:
|
||||
|
@ -308,6 +308,9 @@ void update_stuff()
|
||||
if (NEED(INFO_ENTROPY)) {
|
||||
update_entropy();
|
||||
}
|
||||
if (NEED(INFO_USERS)) {
|
||||
update_users();
|
||||
}
|
||||
}
|
||||
|
||||
int round_to_int(float f)
|
||||
|
329
src/conky.c
329
src/conky.c
@ -117,8 +117,11 @@ static void print_version()
|
||||
#endif /* RSS */
|
||||
#ifdef HAVE_IWLIB
|
||||
" * wireless\n"
|
||||
#endif
|
||||
"", SYSTEM_CONFIG_FILE
|
||||
#endif /* HAVE_IWLIB */
|
||||
#ifdef SMAPI
|
||||
" * smapi\n"
|
||||
#endif /* SMAPI */
|
||||
"", SYSTEM_CONFIG_FILE
|
||||
);
|
||||
|
||||
exit(0);
|
||||
@ -135,8 +138,12 @@ static int text_width, text_height;
|
||||
enum alignment {
|
||||
TOP_LEFT = 1,
|
||||
TOP_RIGHT,
|
||||
TOP_MIDDLE,
|
||||
BOTTOM_LEFT,
|
||||
BOTTOM_RIGHT,
|
||||
BOTTOM_MIDDLE,
|
||||
MIDDLE_LEFT,
|
||||
MIDDLE_RIGHT,
|
||||
NONE
|
||||
};
|
||||
|
||||
@ -1031,6 +1038,9 @@ static void human_readable(long long num, char *buf, int size, char *func_name)
|
||||
|
||||
enum text_object_type {
|
||||
OBJ_addr,
|
||||
#if defined(__linux__)
|
||||
OBJ_addrs,
|
||||
#endif /* __linux__ */
|
||||
#ifndef __OpenBSD__
|
||||
OBJ_acpiacadapter,
|
||||
OBJ_adt746xcpu,
|
||||
@ -1056,6 +1066,9 @@ enum text_object_type {
|
||||
OBJ_color7,
|
||||
OBJ_color8,
|
||||
OBJ_color9,
|
||||
OBJ_conky_version,
|
||||
OBJ_conky_build_date,
|
||||
OBJ_conky_build_arch,
|
||||
OBJ_font,
|
||||
OBJ_cpu,
|
||||
OBJ_cpubar,
|
||||
@ -1088,6 +1101,7 @@ enum text_object_type {
|
||||
OBJ_fs_free,
|
||||
OBJ_fs_free_perc,
|
||||
OBJ_fs_size,
|
||||
OBJ_fs_type,
|
||||
OBJ_fs_used,
|
||||
OBJ_fs_used_perc,
|
||||
OBJ_goto,
|
||||
@ -1116,6 +1130,7 @@ enum text_object_type {
|
||||
OBJ_ibm_temps,
|
||||
OBJ_ibm_volume,
|
||||
OBJ_ibm_brightness,
|
||||
OBJ_if_up,
|
||||
OBJ_pb_battery,
|
||||
OBJ_voltage_mv,
|
||||
OBJ_voltage_v,
|
||||
@ -1179,6 +1194,10 @@ enum text_object_type {
|
||||
OBJ_upspeedgraph,
|
||||
OBJ_uptime,
|
||||
OBJ_uptime_short,
|
||||
OBJ_user_names,
|
||||
OBJ_user_terms,
|
||||
OBJ_user_times,
|
||||
OBJ_user_number,
|
||||
OBJ_imap,
|
||||
OBJ_imap_messages,
|
||||
OBJ_imap_unseen,
|
||||
@ -1226,8 +1245,6 @@ enum text_object_type {
|
||||
OBJ_xmms2_title,
|
||||
OBJ_xmms2_genre,
|
||||
OBJ_xmms2_comment,
|
||||
OBJ_xmms2_decoder,
|
||||
OBJ_xmms2_transport,
|
||||
OBJ_xmms2_url,
|
||||
OBJ_xmms2_date,
|
||||
OBJ_xmms2_tracknr,
|
||||
@ -1240,6 +1257,8 @@ enum text_object_type {
|
||||
OBJ_xmms2_status,
|
||||
OBJ_xmms2_bar,
|
||||
OBJ_xmms2_smart,
|
||||
OBJ_xmms2_playlist,
|
||||
OBJ_xmms2_timesplayed,
|
||||
#endif
|
||||
#ifdef AUDACIOUS
|
||||
OBJ_audacious_status,
|
||||
@ -1276,6 +1295,12 @@ enum text_object_type {
|
||||
#endif
|
||||
#ifdef HDDTEMP
|
||||
OBJ_hddtemp,
|
||||
#endif
|
||||
#ifdef SMAPI
|
||||
OBJ_smapi,
|
||||
OBJ_smapi_bat_bar,
|
||||
OBJ_smapi_bat_perc,
|
||||
OBJ_if_smapi_bat_installed,
|
||||
#endif
|
||||
OBJ_entropy_avail,
|
||||
OBJ_entropy_poolsize,
|
||||
@ -2017,6 +2042,12 @@ static void free_text_objects(unsigned int count, struct text_object *objs)
|
||||
free_iconv();
|
||||
break;
|
||||
#endif
|
||||
#ifdef __LINUX__
|
||||
case OBJ_if_up:
|
||||
free(objs[i].data.ifblock.s);
|
||||
free(objs[i].data.ifblock.str);
|
||||
break;
|
||||
#endif
|
||||
#ifdef XMMS2
|
||||
case OBJ_xmms2_artist:
|
||||
if (info.xmms2.artist) {
|
||||
@ -2048,18 +2079,6 @@ static void free_text_objects(unsigned int count, struct text_object *objs)
|
||||
info.xmms2.comment = 0;
|
||||
}
|
||||
break;
|
||||
case OBJ_xmms2_decoder:
|
||||
if (info.xmms2.decoder) {
|
||||
free(info.xmms2.decoder);
|
||||
info.xmms2.url = 0;
|
||||
}
|
||||
break;
|
||||
case OBJ_xmms2_transport:
|
||||
if (info.xmms2.transport) {
|
||||
free(info.xmms2.transport);
|
||||
info.xmms2.url = 0;
|
||||
}
|
||||
break;
|
||||
case OBJ_xmms2_url:
|
||||
if (info.xmms2.url) {
|
||||
free(info.xmms2.url);
|
||||
@ -2078,6 +2097,12 @@ static void free_text_objects(unsigned int count, struct text_object *objs)
|
||||
info.xmms2.status = 0;
|
||||
}
|
||||
break;
|
||||
case OBJ_xmms2_playlist:
|
||||
if (info.xmms2.playlist) {
|
||||
free(info.xmms2.playlist);
|
||||
info.xmms2.playlist = 0;
|
||||
}
|
||||
break;
|
||||
case OBJ_xmms2_smart:
|
||||
if (info.xmms2.artist) {
|
||||
free(info.xmms2.artist);
|
||||
@ -2148,6 +2173,24 @@ static void free_text_objects(unsigned int count, struct text_object *objs)
|
||||
case OBJ_entropy_poolsize:
|
||||
case OBJ_entropy_bar:
|
||||
break;
|
||||
case OBJ_user_names:
|
||||
if (info.users.names) {
|
||||
free(info.users.names);
|
||||
info.users.names = 0;
|
||||
}
|
||||
break;
|
||||
case OBJ_user_terms:
|
||||
if (info.users.terms) {
|
||||
free(info.users.terms);
|
||||
info.users.terms = 0;
|
||||
}
|
||||
break;
|
||||
case OBJ_user_times:
|
||||
if (info.users.times) {
|
||||
free(info.users.times);
|
||||
info.users.times = 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
free(objs);
|
||||
@ -2190,7 +2233,7 @@ static void free_text_objects(unsigned int count, struct text_object *objs)
|
||||
}
|
||||
#endif
|
||||
/* text_objects = NULL;
|
||||
text_object_count = 0; */
|
||||
text_object_count = 0; */
|
||||
}
|
||||
|
||||
void scan_mixer_bar(const char *arg, int *a, int *w, int *h)
|
||||
@ -2404,6 +2447,18 @@ static struct text_object *construct_text_object(const char *s,
|
||||
obj->data.sensor = atoi(&arg[0]);
|
||||
END OBJ(ibm_volume, 0)
|
||||
END OBJ(ibm_brightness, 0)
|
||||
END OBJ(if_up, 0)
|
||||
if (blockdepth >= MAX_IF_BLOCK_DEPTH) {
|
||||
CRIT_ERR("MAX_IF_BLOCK_DEPTH exceeded");
|
||||
}
|
||||
if (!arg) {
|
||||
ERR("if_up needs an argument");
|
||||
obj->data.ifblock.s = 0;
|
||||
} else
|
||||
obj->data.ifblock.s = strdup(arg);
|
||||
blockstart[blockdepth] = object_count;
|
||||
obj->data.ifblock.pos = object_count + 2;
|
||||
blockdepth++;
|
||||
END OBJ(pb_battery, 0)
|
||||
if (arg && strcmp(arg, "status") == 0) {
|
||||
obj->data.i = PB_BATT_STATUS;
|
||||
@ -2566,6 +2621,9 @@ static struct text_object *construct_text_object(const char *s,
|
||||
obj->data.l = color9;
|
||||
END OBJ(font, 0)
|
||||
obj->data.s = scan_font(arg);
|
||||
END OBJ(conky_version, 0)
|
||||
END OBJ(conky_build_date, 0)
|
||||
END OBJ(conky_build_arch, 0)
|
||||
END OBJ(downspeed, INFO_NET)
|
||||
if (arg) {
|
||||
obj->data.net = get_net_stat(arg);
|
||||
@ -2734,6 +2792,11 @@ static struct text_object *construct_text_object(const char *s,
|
||||
arg = "/";
|
||||
}
|
||||
obj->data.fs = prepare_fs_stat(arg);
|
||||
END OBJ(fs_type, INFO_FS)
|
||||
if (!arg) {
|
||||
arg = "/";
|
||||
}
|
||||
obj->data.fs = prepare_fs_stat(arg);
|
||||
END OBJ(fs_used, INFO_FS)
|
||||
if (!arg) {
|
||||
arg = "/";
|
||||
@ -2920,6 +2983,14 @@ static struct text_object *construct_text_object(const char *s,
|
||||
} else {
|
||||
CRIT_ERR("addr needs argument");
|
||||
}
|
||||
#if defined(__linux__)
|
||||
END OBJ(addrs, INFO_NET)
|
||||
if (arg) {
|
||||
obj->data.net = get_net_stat(arg);
|
||||
} else {
|
||||
CRIT_ERR("addrs needs argument");
|
||||
}
|
||||
#endif /* __linux__ */
|
||||
END OBJ(tail, 0)
|
||||
char buf[64];
|
||||
int n1, n2;
|
||||
@ -3371,6 +3442,10 @@ static struct text_object *construct_text_object(const char *s,
|
||||
}
|
||||
END OBJ(uptime_short, INFO_UPTIME)
|
||||
END OBJ(uptime, INFO_UPTIME)
|
||||
END OBJ(user_names, INFO_USERS)
|
||||
END OBJ(user_times, INFO_USERS)
|
||||
END OBJ(user_terms, INFO_USERS)
|
||||
END OBJ(user_number, INFO_USERS)
|
||||
#ifndef __OpenBSD__
|
||||
END OBJ(adt746xcpu, 0)
|
||||
END OBJ(adt746xfan, 0)
|
||||
@ -3413,16 +3488,52 @@ static struct text_object *construct_text_object(const char *s,
|
||||
} else {
|
||||
obj->global_mode = 1;
|
||||
}
|
||||
#ifdef MPD
|
||||
END OBJ(mpd_artist, INFO_MPD)
|
||||
END OBJ(mpd_title, INFO_MPD)
|
||||
if (arg) {
|
||||
sscanf(arg, "%d", &info.mpd.max_title_len);
|
||||
if (info.mpd.max_title_len > 0) {
|
||||
info.mpd.max_title_len++;
|
||||
#ifdef SMAPI
|
||||
END OBJ(smapi, 0)
|
||||
if (arg)
|
||||
obj->data.s = strdup(arg);
|
||||
else
|
||||
ERR("smapi needs an argument");
|
||||
END OBJ(if_smapi_bat_installed, 0)
|
||||
if (blockdepth >= MAX_IF_BLOCK_DEPTH) {
|
||||
CRIT_ERR("MAX_IF_BLOCK_DEPTH exceeded");
|
||||
}
|
||||
if (!arg) {
|
||||
ERR("if_smapi_bat_installed needs an argument");
|
||||
obj->data.ifblock.s = 0;
|
||||
} else
|
||||
obj->data.ifblock.s = strdup(arg);
|
||||
blockstart[blockdepth] = object_count;
|
||||
obj->data.ifblock.pos = object_count + 2;
|
||||
blockdepth++;
|
||||
END OBJ(smapi_bat_perc, 0)
|
||||
if (arg)
|
||||
obj->data.s = strdup(arg);
|
||||
else
|
||||
ERR("smapi_bat_perc needs an argument");
|
||||
END OBJ(smapi_bat_bar, 0)
|
||||
if(arg) {
|
||||
int cnt;
|
||||
if(sscanf(arg, "%i %n", &obj->data.i, &cnt) <= 0) {
|
||||
ERR("first argument to smapi_bat_bar must be an integer value");
|
||||
obj->data.i = -1;
|
||||
} else {
|
||||
CRIT_ERR("mpd_title: invalid length argument");
|
||||
obj->b = 4;
|
||||
arg = scan_bar(arg + cnt, &obj->a, &obj->b);
|
||||
}
|
||||
} else
|
||||
ERR("if_smapi_bat_bar needs an argument");
|
||||
#endif /* SMAPI */
|
||||
#ifdef MPD
|
||||
END OBJ(mpd_artist, INFO_MPD)
|
||||
END OBJ(mpd_title, INFO_MPD)
|
||||
if (arg) {
|
||||
sscanf(arg, "%d", &info.mpd.max_title_len);
|
||||
if (info.mpd.max_title_len > 0) {
|
||||
info.mpd.max_title_len++;
|
||||
} else {
|
||||
CRIT_ERR("mpd_title: invalid length argument");
|
||||
}
|
||||
} else {
|
||||
info.mpd.max_title_len = 0;
|
||||
}
|
||||
@ -3448,8 +3559,6 @@ static struct text_object *construct_text_object(const char *s,
|
||||
END OBJ(xmms2_title, INFO_XMMS2)
|
||||
END OBJ(xmms2_genre, INFO_XMMS2)
|
||||
END OBJ(xmms2_comment, INFO_XMMS2)
|
||||
END OBJ(xmms2_decoder, INFO_XMMS2)
|
||||
END OBJ(xmms2_transport, INFO_XMMS2)
|
||||
END OBJ(xmms2_url, INFO_XMMS2)
|
||||
END OBJ(xmms2_tracknr, INFO_XMMS2)
|
||||
END OBJ(xmms2_bitrate, INFO_XMMS2)
|
||||
@ -3463,6 +3572,8 @@ static struct text_object *construct_text_object(const char *s,
|
||||
END OBJ(xmms2_bar, INFO_XMMS2)
|
||||
scan_bar(arg, &obj->data.pair.a, &obj->data.pair.b);
|
||||
END OBJ(xmms2_smart, INFO_XMMS2)
|
||||
END OBJ(xmms2_playlist, INFO_XMMS2)
|
||||
END OBJ(xmms2_timesplayed, INFO_XMMS2)
|
||||
#endif
|
||||
#ifdef AUDACIOUS
|
||||
END OBJ(audacious_status, INFO_AUDACIOUS)
|
||||
@ -3994,7 +4105,7 @@ static void generate_text_internal(char *p, int p_max_size,
|
||||
}
|
||||
OBJ(wireless_link_qual_perc) {
|
||||
if (obj->data.net->link_qual_max > 0) {
|
||||
spaced_print(p, p_max_size, "%.0f%%", 5,
|
||||
spaced_print(p, p_max_size, "%.0f", 5,
|
||||
"wireless_link_qual_perc",
|
||||
(double) obj->data.net->link_qual /
|
||||
obj->data.net->link_qual_max * 100);
|
||||
@ -4044,7 +4155,8 @@ static void generate_text_internal(char *p, int p_max_size,
|
||||
get_battery_stuff(p, p_max_size, obj->data.s, BATTERY_TIME);
|
||||
}
|
||||
OBJ(battery_percent) {
|
||||
snprintf(p, p_max_size, "%d", get_battery_perct(obj->data.s));
|
||||
spaced_print(p, p_max_size, "%*d", pad_percents,
|
||||
"battery_percent", get_battery_perct(obj->data.s));
|
||||
}
|
||||
OBJ(battery_bar) {
|
||||
new_bar(p, obj->a, obj->b, get_battery_perct_bar(obj->data.s));
|
||||
@ -4108,6 +4220,15 @@ static void generate_text_internal(char *p, int p_max_size,
|
||||
OBJ(color9) {
|
||||
new_fg(p, color9);
|
||||
}
|
||||
OBJ(conky_version) {
|
||||
snprintf(p, p_max_size, "%s", VERSION);
|
||||
}
|
||||
OBJ(conky_build_date) {
|
||||
snprintf(p, p_max_size, "%s", BUILD_DATE);
|
||||
}
|
||||
OBJ(conky_build_arch) {
|
||||
snprintf(p, p_max_size, "%s", BUILD_ARCH);
|
||||
}
|
||||
#if defined(__linux__)
|
||||
OBJ(i8k_version) {
|
||||
snprintf(p, p_max_size, "%s", i8k.version);
|
||||
@ -4191,6 +4312,15 @@ static void generate_text_internal(char *p, int p_max_size,
|
||||
OBJ(ibm_brightness) {
|
||||
get_ibm_acpi_brightness(p, p_max_size);
|
||||
}
|
||||
OBJ(if_up) {
|
||||
if ((obj->data.ifblock.s)
|
||||
&& (!interface_up(obj->data.ifblock.s))) {
|
||||
i = obj->data.ifblock.pos;
|
||||
if_jumped = 1;
|
||||
} else {
|
||||
if_jumped = 0;
|
||||
}
|
||||
}
|
||||
OBJ(pb_battery) {
|
||||
get_powerbook_batt_info(p, p_max_size, obj->data.i);
|
||||
}
|
||||
@ -4316,6 +4446,18 @@ static void generate_text_internal(char *p, int p_max_size,
|
||||
obj->data.net->addr.sa_data[5] & 255);
|
||||
}
|
||||
|
||||
#if defined(__linux__)
|
||||
OBJ(addrs) {
|
||||
if(NULL != obj->data.net->addrs && strlen(obj->data.net->addrs) > 2)
|
||||
{
|
||||
obj->data.net->addrs[strlen(obj->data.net->addrs) - 2] = 0; /* remove ", " from end of string */
|
||||
strcpy(p, obj->data.net->addrs);
|
||||
}
|
||||
else
|
||||
strcpy(p, "0.0.0.0");
|
||||
}
|
||||
#endif /* __linux__ */
|
||||
|
||||
#if defined(IMLIB2) && defined(X11)
|
||||
OBJ(image) {
|
||||
if (obj->a < 1) {
|
||||
@ -4747,8 +4889,8 @@ static void generate_text_internal(char *p, int p_max_size,
|
||||
OBJ(fs_free_perc) {
|
||||
if (obj->data.fs != NULL) {
|
||||
if (obj->data.fs->size) {
|
||||
snprintf(p, p_max_size, "%*d", pad_percents,
|
||||
(int) ((obj->data.fs->avail * 100) /
|
||||
spaced_print(p, p_max_size, "%*d", pad_percents,
|
||||
"fs_free_perc", (int) ((obj->data.fs->avail * 100) /
|
||||
obj->data.fs->size));
|
||||
} else {
|
||||
snprintf(p, p_max_size, "0");
|
||||
@ -4760,6 +4902,10 @@ static void generate_text_internal(char *p, int p_max_size,
|
||||
human_readable(obj->data.fs->size, p, 255, "fs_size");
|
||||
}
|
||||
}
|
||||
OBJ(fs_type) {
|
||||
if (obj->data.fs != NULL)
|
||||
snprintf(p, p_max_size, "%s", obj->data.fs->type);
|
||||
}
|
||||
OBJ(fs_used) {
|
||||
if (obj->data.fs != NULL) {
|
||||
human_readable(obj->data.fs->size - (obj->data.fs->free
|
||||
@ -4781,8 +4927,8 @@ static void generate_text_internal(char *p, int p_max_size,
|
||||
OBJ(fs_used_perc) {
|
||||
if (obj->data.fs != NULL) {
|
||||
if (obj->data.fs->size) {
|
||||
snprintf(p, 4, "%d",
|
||||
100 - ((int) ((obj->data.fs->avail * 100) /
|
||||
spaced_print(p, 4, "%*d", pad_percents,
|
||||
"fs_used_perc", 100 - ((int) ((obj->data.fs->avail * 100) /
|
||||
obj->data.fs->size)));
|
||||
} else {
|
||||
snprintf(p, p_max_size, "0");
|
||||
@ -5174,7 +5320,18 @@ static void generate_text_internal(char *p, int p_max_size,
|
||||
OBJ(uptime) {
|
||||
format_seconds(p, p_max_size, (int) cur->uptime);
|
||||
}
|
||||
|
||||
OBJ(user_names) {
|
||||
snprintf(p, p_max_size, "%s", cur->users.names);
|
||||
}
|
||||
OBJ(user_terms) {
|
||||
snprintf(p, p_max_size, "%s", cur->users.terms);
|
||||
}
|
||||
OBJ(user_times) {
|
||||
snprintf(p, p_max_size, "%s", cur->users.times);
|
||||
}
|
||||
OBJ(user_number) {
|
||||
snprintf(p, p_max_size, "%d", cur->users.number);
|
||||
}
|
||||
#if (defined(__FreeBSD__) || defined(__FreeBSD_kernel__) \
|
||||
|| defined(__OpenBSD__)) && (defined(i386) || defined(__i386__))
|
||||
OBJ(apm_adapter) {
|
||||
@ -5291,7 +5448,8 @@ static void generate_text_internal(char *p, int p_max_size,
|
||||
}
|
||||
}
|
||||
OBJ(mpd_percent) {
|
||||
snprintf(p, p_max_size, "%2.0f", cur->mpd.progress * 100);
|
||||
spaced_print(p, p_max_size, "%*d", pad_percents,
|
||||
"mpd_percent", (int) (cur->mpd.progress * 100));
|
||||
}
|
||||
OBJ(mpd_bar) {
|
||||
new_bar(p, obj->data.pair.a, obj->data.pair.b,
|
||||
@ -5331,12 +5489,6 @@ static void generate_text_internal(char *p, int p_max_size,
|
||||
OBJ(xmms2_comment) {
|
||||
snprintf(p, p_max_size, "%s", cur->xmms2.comment);
|
||||
}
|
||||
OBJ(xmms2_decoder) {
|
||||
snprintf(p, p_max_size, "%s", cur->xmms2.decoder);
|
||||
}
|
||||
OBJ(xmms2_transport) {
|
||||
snprintf(p, p_max_size, "%s", cur->xmms2.transport);
|
||||
}
|
||||
OBJ(xmms2_url) {
|
||||
snprintf(p, p_max_size, "%s", cur->xmms2.url);
|
||||
}
|
||||
@ -5376,6 +5528,12 @@ static void generate_text_internal(char *p, int p_max_size,
|
||||
new_bar(p, obj->data.pair.a, obj->data.pair.b,
|
||||
(int) (cur->xmms2.progress * 255.0f));
|
||||
}
|
||||
OBJ(xmms2_playlist) {
|
||||
snprintf(p, p_max_size, "%s", cur->xmms2.playlist);
|
||||
}
|
||||
OBJ(xmms2_timesplayed) {
|
||||
snprintf(p, p_max_size, "%i", cur->xmms2.timesplayed);
|
||||
}
|
||||
OBJ(xmms2_smart) {
|
||||
if (strlen(cur->xmms2.title) < 2
|
||||
&& strlen(cur->xmms2.title) < 2) {
|
||||
@ -5758,6 +5916,43 @@ head:
|
||||
(double) cur->entropy.poolsize;
|
||||
new_bar(p, obj->a, obj->b, (int) (entropy_perc * 255.0f));
|
||||
}
|
||||
#ifdef SMAPI
|
||||
OBJ(smapi) {
|
||||
char *s;
|
||||
if(obj->data.s) {
|
||||
s = smapi_get_val(obj->data.s);
|
||||
snprintf(p, p_max_size, "%s", s);
|
||||
free(s);
|
||||
}
|
||||
}
|
||||
OBJ(if_smapi_bat_installed) {
|
||||
int idx;
|
||||
if(obj->data.ifblock.s && sscanf(obj->data.ifblock.s, "%i", &idx) == 1) {
|
||||
if(!smapi_bat_installed(idx)) {
|
||||
i = obj->data.ifblock.pos;
|
||||
if_jumped = 1;
|
||||
} else
|
||||
if_jumped = 0;
|
||||
} else
|
||||
ERR("argument to if_smapi_bat_installed must be an integer");
|
||||
}
|
||||
OBJ(smapi_bat_perc) {
|
||||
int idx, val;
|
||||
if(obj->data.s && sscanf(obj->data.s, "%i", &idx) == 1) {
|
||||
val = smapi_bat_installed(idx) ?
|
||||
smapi_get_bat_int(idx, "remaining_percent") : 0;
|
||||
spaced_print(p, p_max_size, "%*d", pad_percents, "smapi_bat_perc", val);
|
||||
} else
|
||||
ERR("argument to smapi_bat_perc must be an integer");
|
||||
}
|
||||
OBJ(smapi_bat_bar) {
|
||||
if(obj->data.i >= 0 && smapi_bat_installed(obj->data.i))
|
||||
new_bar(p, obj->a, obj->b, (int)
|
||||
(255 * smapi_get_bat_int(obj->data.i, "remaining_percent") / 100));
|
||||
else
|
||||
new_bar(p, obj->a, obj->b, 0);
|
||||
}
|
||||
#endif /* SMAPI */
|
||||
|
||||
break;
|
||||
}
|
||||
@ -5780,7 +5975,7 @@ head:
|
||||
iconv(*iconv_cd[iconv_selected - 1], NULL, NULL, NULL, NULL);
|
||||
while (dummy1 > 0) {
|
||||
bytes = iconv(*iconv_cd[iconv_selected - 1], &ptr, &dummy1,
|
||||
&outptr, &dummy2);
|
||||
&outptr, &dummy2);
|
||||
if (bytes == -1) {
|
||||
ERR("Iconv codeset conversion failed");
|
||||
break;
|
||||
@ -5947,6 +6142,11 @@ static void update_text_area()
|
||||
y = gap_y;
|
||||
break;
|
||||
|
||||
case TOP_MIDDLE:
|
||||
x = workarea[2] / 2 - text_width / 2 - gap_x;
|
||||
y = gap_y;
|
||||
break;
|
||||
|
||||
default:
|
||||
case BOTTOM_LEFT:
|
||||
x = gap_x;
|
||||
@ -5958,6 +6158,21 @@ static void update_text_area()
|
||||
y = workarea[3] - text_height - gap_y;
|
||||
break;
|
||||
|
||||
case BOTTOM_MIDDLE:
|
||||
x = workarea[2] / 2 - text_width / 2 - gap_x;
|
||||
y = workarea[3] - text_height - gap_y;
|
||||
break;
|
||||
|
||||
case MIDDLE_LEFT:
|
||||
x = gap_x;
|
||||
y = workarea[3] / 2 - text_height / 2 - gap_y;
|
||||
break;
|
||||
|
||||
case MIDDLE_RIGHT:
|
||||
x = workarea[2] - text_width - gap_x;
|
||||
y = workarea[3] / 2 - text_height / 2 - gap_y;
|
||||
break;
|
||||
|
||||
#ifdef OWN_WINDOW
|
||||
case NONE: // Let the WM manage the window
|
||||
x = window.x;
|
||||
@ -6981,8 +7196,9 @@ static void main_loop()
|
||||
#endif
|
||||
|
||||
switch (g_signal_pending) {
|
||||
case SIGHUP:
|
||||
case SIGUSR1:
|
||||
ERR("received SIGUSR1. reloading the config file.");
|
||||
ERR("received SIGHUP or SIGUSR1. reloading the config file.");
|
||||
reload_config();
|
||||
break;
|
||||
case SIGINT:
|
||||
@ -7194,18 +7410,34 @@ static enum alignment string_to_alignment(const char *s)
|
||||
return TOP_LEFT;
|
||||
} else if (strcasecmp(s, "top_right") == 0) {
|
||||
return TOP_RIGHT;
|
||||
} else if (strcasecmp(s, "top_middle") == 0) {
|
||||
return TOP_MIDDLE;
|
||||
} else if (strcasecmp(s, "bottom_left") == 0) {
|
||||
return BOTTOM_LEFT;
|
||||
} else if (strcasecmp(s, "bottom_right") == 0) {
|
||||
return BOTTOM_RIGHT;
|
||||
} else if (strcasecmp(s, "bottom_middle") == 0) {
|
||||
return BOTTOM_MIDDLE;
|
||||
} else if (strcasecmp(s, "middle_left") == 0) {
|
||||
return MIDDLE_LEFT;
|
||||
} else if (strcasecmp(s, "middle_right") == 0) {
|
||||
return MIDDLE_RIGHT;
|
||||
} else if (strcasecmp(s, "tl") == 0) {
|
||||
return TOP_LEFT;
|
||||
} else if (strcasecmp(s, "tr") == 0) {
|
||||
return TOP_RIGHT;
|
||||
} else if (strcasecmp(s, "tm") == 0) {
|
||||
return TOP_MIDDLE;
|
||||
} else if (strcasecmp(s, "bl") == 0) {
|
||||
return BOTTOM_LEFT;
|
||||
} else if (strcasecmp(s, "br") == 0) {
|
||||
return BOTTOM_RIGHT;
|
||||
} else if (strcasecmp(s, "bm") == 0) {
|
||||
return BOTTOM_MIDDLE;
|
||||
} else if (strcasecmp(s, "ml") == 0) {
|
||||
return MIDDLE_LEFT;
|
||||
} else if (strcasecmp(s, "mr") == 0) {
|
||||
return MIDDLE_RIGHT;
|
||||
} else if (strcasecmp(s, "none") == 0) {
|
||||
return NONE;
|
||||
}
|
||||
@ -7242,10 +7474,9 @@ static void set_default_configurations(void)
|
||||
info.xmms2.title = NULL;
|
||||
info.xmms2.genre = NULL;
|
||||
info.xmms2.comment = NULL;
|
||||
info.xmms2.decoder = NULL;
|
||||
info.xmms2.transport = NULL;
|
||||
info.xmms2.url = NULL;
|
||||
info.xmms2.status = NULL;
|
||||
info.xmms2.playlist = NULL;
|
||||
#endif
|
||||
use_spacer = NO_SPACER;
|
||||
#ifdef X11
|
||||
@ -7305,6 +7536,7 @@ static void set_default_configurations(void)
|
||||
update_interval = 3.0;
|
||||
info.music_player_interval = 1.0;
|
||||
stuff_in_upper_case = 0;
|
||||
info.users.number = 1;
|
||||
|
||||
#ifdef TCP_PORT_MONITOR
|
||||
tcp_port_monitor_args.max_port_monitor_connections =
|
||||
@ -8260,9 +8492,15 @@ int main(int argc, char **argv)
|
||||
selected_font = 0;
|
||||
update_text_area(); /* to get initial size of the window */
|
||||
|
||||
#ifdef OWN_WINDOW
|
||||
init_window(own_window, text_width + border_margin * 2 + 1,
|
||||
text_height + border_margin * 2 + 1, set_transparent, background_colour,
|
||||
argv, argc);
|
||||
#else /* OWN_WINDOW */
|
||||
init_window(0, text_width + border_margin * 2 + 1,
|
||||
text_height + border_margin * 2 + 1, set_transparent, 0,
|
||||
argv, argc);
|
||||
#endif /* OWN_WINDOW */
|
||||
|
||||
selected_font = 0;
|
||||
update_text_area(); /* to position text/window on screen */
|
||||
@ -8294,6 +8532,7 @@ int main(int argc, char **argv)
|
||||
|
||||
if (sigaction(SIGINT, &act, &oact) < 0
|
||||
|| sigaction(SIGUSR1, &act, &oact) < 0
|
||||
|| sigaction(SIGHUP,&act,&oact) < 0
|
||||
|| sigaction(SIGTERM, &act, &oact) < 0) {
|
||||
ERR("error setting signal handler: %s", strerror(errno));
|
||||
}
|
||||
|
27
src/conky.h
27
src/conky.h
@ -23,7 +23,9 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* $Id$ */
|
||||
* $Id$
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _conky_h_
|
||||
#define _conky_h_
|
||||
@ -70,6 +72,10 @@
|
||||
#include "prss.h"
|
||||
#endif
|
||||
|
||||
#ifdef SMAPI
|
||||
#include "smapi.h"
|
||||
#endif
|
||||
|
||||
#include "mboxscan.h"
|
||||
#include "timed_thread.h"
|
||||
|
||||
@ -119,6 +125,7 @@ struct net_stat {
|
||||
long long recv, trans;
|
||||
double recv_speed, trans_speed;
|
||||
struct sockaddr addr;
|
||||
char* addrs;
|
||||
double net_rec[15], net_trans[15];
|
||||
// wireless extensions
|
||||
char essid[32];
|
||||
@ -135,6 +142,7 @@ unsigned int diskio_write_value;
|
||||
|
||||
struct fs_stat {
|
||||
char *path;
|
||||
char *type;
|
||||
long long size;
|
||||
long long avail;
|
||||
long long free;
|
||||
@ -195,15 +203,15 @@ struct xmms2_s {
|
||||
char *title;
|
||||
char *genre;
|
||||
char *comment;
|
||||
char *decoder;
|
||||
char *transport;
|
||||
char *url;
|
||||
char *date;
|
||||
char* playlist;
|
||||
int tracknr;
|
||||
int bitrate;
|
||||
unsigned int id;
|
||||
int duration;
|
||||
int elapsed;
|
||||
int timesplayed;
|
||||
float size;
|
||||
|
||||
float progress;
|
||||
@ -237,6 +245,13 @@ struct entropy_s {
|
||||
unsigned int poolsize;
|
||||
};
|
||||
|
||||
struct usr_info {
|
||||
char *names;
|
||||
char *times;
|
||||
char *terms;
|
||||
int number;
|
||||
};
|
||||
|
||||
#ifdef TCP_PORT_MONITOR
|
||||
#include "libtcp-portmon.h"
|
||||
#define MAX_PORT_MONITOR_CONNECTIONS_DEFAULT 256
|
||||
@ -280,6 +295,10 @@ enum {
|
||||
#ifdef RSS
|
||||
INFO_RSS = 24,
|
||||
#endif
|
||||
#ifdef SMAPI
|
||||
INFO_SMAPI = 25,
|
||||
#endif
|
||||
INFO_USERS = 26,
|
||||
};
|
||||
|
||||
/* get_battery_stuff() item selector */
|
||||
@ -341,6 +360,7 @@ struct information {
|
||||
#ifdef BMPX
|
||||
struct bmpx_s bmpx;
|
||||
#endif
|
||||
struct usr_info users;
|
||||
struct process *cpu[10];
|
||||
struct process *memu[10];
|
||||
struct process *first_process;
|
||||
@ -487,6 +507,7 @@ 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_users();
|
||||
|
||||
void update_stuff();
|
||||
|
||||
|
48
src/fs.c
48
src/fs.c
@ -46,6 +46,10 @@
|
||||
#include <sys/mount.h>
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_STRUCT_STATFS_F_FSTYPENAME
|
||||
#include <mntent.h>
|
||||
#endif
|
||||
|
||||
#define MAX_FS_STATS 64
|
||||
|
||||
static struct fs_stat fs_stats_[MAX_FS_STATS];
|
||||
@ -53,6 +57,8 @@ struct fs_stat *fs_stats = fs_stats_;
|
||||
|
||||
static void update_fs_stat(struct fs_stat *fs);
|
||||
|
||||
static char* get_fs_type(const char* path);
|
||||
|
||||
void update_fs_stats()
|
||||
{
|
||||
unsigned i;
|
||||
@ -71,6 +77,7 @@ void clear_fs_stats()
|
||||
for (i = 0; i < MAX_FS_STATS; ++i) {
|
||||
if (fs_stats[i].path) {
|
||||
free(fs_stats[i].path);
|
||||
free(fs_stats[i].type);
|
||||
fs_stats[i].path = NULL;
|
||||
}
|
||||
}
|
||||
@ -110,10 +117,51 @@ static void update_fs_stat(struct fs_stat *fs)
|
||||
/* bfree (root) or bavail (non-roots) ? */
|
||||
fs->avail = (long long) s.f_bavail * s.f_bsize;
|
||||
fs->free = (long long) s.f_bfree * s.f_bsize;
|
||||
fs->type = get_fs_type(fs->path);
|
||||
} else {
|
||||
fs->size = 0;
|
||||
fs->avail = 0;
|
||||
fs->free = 0;
|
||||
fs->type = "unknown";
|
||||
ERR("statfs '%s': %s", fs->path, strerror(errno));
|
||||
}
|
||||
}
|
||||
|
||||
static char* get_fs_type(const char* path)
|
||||
{
|
||||
|
||||
#ifdef HAVE_STRUCT_STATFS_F_FSTYPENAME
|
||||
|
||||
struct statfs s;
|
||||
if(statfs(path, &s) == 0)
|
||||
return s.f_fstypename;
|
||||
else
|
||||
ERR("statfs '%s': %s", path, strerror(errno));
|
||||
|
||||
#else
|
||||
|
||||
/* TODO: walk up the directory tree so it works on
|
||||
* on paths that are not actually mount points. */
|
||||
|
||||
FILE* mtab = setmntent( "/etc/mtab", "r" );
|
||||
|
||||
if(mtab == NULL) {
|
||||
ERR("setmntent /etc/mtab: %s", strerror(errno));
|
||||
return "unknown";
|
||||
}
|
||||
|
||||
struct mntent* me = getmntent(mtab);
|
||||
|
||||
// find our path in the mtab
|
||||
while(getmntent(mtab) && strcmp(path,me->mnt_dir));
|
||||
|
||||
endmntent(mtab);
|
||||
|
||||
if(me)
|
||||
return strdup(me->mnt_type);
|
||||
|
||||
#endif // HAVE_STRUCT_STATFS_F_FSTYPENAME
|
||||
|
||||
return "unknown";
|
||||
|
||||
}
|
||||
|
50
src/linux.c
50
src/linux.c
@ -166,6 +166,28 @@ void update_meminfo()
|
||||
fclose(meminfo_fp);
|
||||
}
|
||||
|
||||
int interface_up(const char *dev)
|
||||
{
|
||||
int fd;
|
||||
struct ifreq ifr;
|
||||
|
||||
if((fd = socket(PF_INET, SOCK_DGRAM, 0)) < 0) {
|
||||
CRIT_ERR("could not create sockfd");
|
||||
return 0;
|
||||
}
|
||||
strncpy(ifr.ifr_name, dev, IFNAMSIZ);
|
||||
if(ioctl(fd, SIOCGIFFLAGS, &ifr)) {
|
||||
/* if device does not exist, treat like not up */
|
||||
if (errno != ENODEV)
|
||||
perror("SIOCGIFFLAGS");
|
||||
} else {
|
||||
close(fd);
|
||||
return (ifr.ifr_flags & IFF_UP);
|
||||
}
|
||||
close(fd);
|
||||
return 0;
|
||||
}
|
||||
|
||||
inline void update_net_stats()
|
||||
{
|
||||
FILE *net_dev_fp;
|
||||
@ -205,6 +227,7 @@ inline void update_net_stats()
|
||||
for (i2 = 0; i2 < 16; i2++) {
|
||||
struct net_stat *ns;
|
||||
char *s, *p;
|
||||
char temp_addr[17];
|
||||
long long r, t, last_recv, last_trans;
|
||||
|
||||
if (fgets(buf, 255, net_dev_fp) == NULL) {
|
||||
@ -229,6 +252,12 @@ inline void update_net_stats()
|
||||
ns = get_net_stat(s);
|
||||
ns->up = 1;
|
||||
memset(&(ns->addr.sa_data), 0, 14);
|
||||
|
||||
if(NULL == ns->addrs)
|
||||
ns->addrs = (char*) malloc(17 * 16);
|
||||
if(NULL != ns->addrs)
|
||||
memset(ns->addrs, 0, 17 * 16); /* Up to 17 chars per ip, max 16 interfaces. Nasty memory usage... */
|
||||
|
||||
last_recv = ns->recv;
|
||||
last_trans = ns->trans;
|
||||
|
||||
@ -266,6 +295,16 @@ inline void update_net_stats()
|
||||
ns = get_net_stat(
|
||||
((struct ifreq *) conf.ifc_buf)[k].ifr_ifrn.ifrn_name);
|
||||
ns->addr = ((struct ifreq *) conf.ifc_buf)[k].ifr_ifru.ifru_addr;
|
||||
if(NULL != ns->addrs)
|
||||
{
|
||||
sprintf(temp_addr, "%u.%u.%u.%u, ",
|
||||
ns->addr.sa_data[2] & 255,
|
||||
ns->addr.sa_data[3] & 255,
|
||||
ns->addr.sa_data[4] & 255,
|
||||
ns->addr.sa_data[5] & 255);
|
||||
if(NULL == strstr(ns->addrs, temp_addr))
|
||||
strncpy(ns->addrs + strlen(ns->addrs), temp_addr, 17);
|
||||
}
|
||||
}
|
||||
|
||||
close((long) i);
|
||||
@ -773,13 +812,16 @@ double get_sysfs_info(int *fd, int div, char *devtype, char *type)
|
||||
/* read integer */
|
||||
{
|
||||
char buf[64];
|
||||
unsigned int n;
|
||||
|
||||
int n;
|
||||
n = read(*fd, buf, 63);
|
||||
/* should read until n == 0 but I doubt that kernel will give these
|
||||
* in multiple pieces. :) */
|
||||
buf[n] = '\0';
|
||||
val = atoi(buf);
|
||||
if (n < 0) {
|
||||
printf("get_sysfs_info(): read from %s failed\n", devtype);
|
||||
} else {
|
||||
buf[n] = '\0';
|
||||
val = atoi(buf);
|
||||
}
|
||||
}
|
||||
|
||||
close(*fd);
|
||||
|
172
src/users.c
Normal file
172
src/users.c
Normal file
@ -0,0 +1,172 @@
|
||||
/* Conky, a system monitor, based on torsmo
|
||||
*
|
||||
* Any original torsmo code is licensed under the BSD license
|
||||
*
|
||||
* All code written since the fork of torsmo is licensed under the GPL
|
||||
*
|
||||
* Please see COPYING for details
|
||||
*
|
||||
* Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen
|
||||
* Copyright (c) 2005-2007 Brenden Matthews, Philip Kovacs, et. al.
|
||||
* (see AUTHORS)
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* $Id: conky.h 1007 2008-02-20 20:30:45Z IQgryn $
|
||||
*
|
||||
*/
|
||||
|
||||
#include "conky.h"
|
||||
#include <utmp.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
|
||||
static void user_name(char **ptr) {
|
||||
const struct utmp *usr;
|
||||
char buf[512];
|
||||
|
||||
setutent();
|
||||
while((usr=getutent())!=NULL) {
|
||||
if (usr->ut_type==USER_PROCESS) {
|
||||
strncat(buf, usr->ut_name, 9); strcat(buf, "\n");
|
||||
}
|
||||
}
|
||||
*ptr = buf;
|
||||
}
|
||||
static void user_num(int *ptr) {
|
||||
const struct utmp *usr;
|
||||
int users_num = 0;
|
||||
|
||||
setutent();
|
||||
while ((usr=getutent())!=NULL) {
|
||||
if (usr->ut_type==USER_PROCESS) {
|
||||
++users_num;
|
||||
}
|
||||
}
|
||||
*ptr = users_num;
|
||||
}
|
||||
static void user_term(char **ptr) {
|
||||
const struct utmp *usr;
|
||||
char buf[512];
|
||||
|
||||
setutent();
|
||||
while((usr=getutent())!=NULL) {
|
||||
if (usr->ut_type==USER_PROCESS) {
|
||||
strncat(buf, usr->ut_line, 13); strncat(buf, "\n", 3);
|
||||
}
|
||||
}
|
||||
*ptr = buf;
|
||||
}
|
||||
static void user_time(char **ptr) {
|
||||
const struct utmp *usr;
|
||||
time_t login, real, diff;
|
||||
struct tm *dtime;
|
||||
char buf[512] = "";
|
||||
char output[512] = "";
|
||||
|
||||
setutent();
|
||||
while ((usr=getutent())!=NULL) {
|
||||
if (usr->ut_type==USER_PROCESS) {
|
||||
login=usr->ut_time;
|
||||
time(&real);
|
||||
diff = difftime(real, login);
|
||||
dtime = localtime(&diff);
|
||||
dtime->tm_year = dtime->tm_year-70;
|
||||
dtime->tm_mon = dtime->tm_mon-1;
|
||||
dtime->tm_mday = dtime->tm_mday-1;
|
||||
if(dtime->tm_year>0){strftime(buf,512,"%yy %mm %dd %Hh %Mm\n", dtime); goto end;}
|
||||
else if(dtime->tm_mon>0){strftime(buf,512,"%mm %dd %Hh %Mm\n", dtime); goto end;}
|
||||
else if(dtime->tm_mday>0){strftime(buf,512,"%dd %Hh %Mm\n", dtime); goto end;}
|
||||
else if(dtime->tm_hour>0){strftime(buf,512,"%Hh %Mm\n", dtime); goto end;}
|
||||
else if(dtime->tm_min>0){strftime(buf,512,"%Mm\n", dtime); goto end;}
|
||||
end:
|
||||
strncat(output, buf, 512);
|
||||
}
|
||||
}
|
||||
*ptr = output;
|
||||
}
|
||||
|
||||
static void users_alloc(struct information *ptr) {
|
||||
if (ptr->users.names == NULL) {
|
||||
ptr->users.names = malloc(TEXT_BUFFER_SIZE);
|
||||
|
||||
}
|
||||
if (ptr->users.terms == NULL) {
|
||||
ptr->users.terms = malloc(TEXT_BUFFER_SIZE);
|
||||
}
|
||||
if (ptr->users.times == NULL) {
|
||||
ptr->users.times = malloc(TEXT_BUFFER_SIZE);
|
||||
}
|
||||
}
|
||||
|
||||
void update_users() {
|
||||
struct information * current_info = &info;
|
||||
char *temp;
|
||||
int t;
|
||||
users_alloc(current_info);
|
||||
user_name(&temp);
|
||||
if (temp!=NULL) {
|
||||
if (current_info->users.names) {
|
||||
free(current_info->users.names); current_info->users.names = 0;
|
||||
}
|
||||
current_info->users.names = malloc(TEXT_BUFFER_SIZE);
|
||||
strncpy(current_info->users.names, temp, TEXT_BUFFER_SIZE);
|
||||
} else {
|
||||
if (current_info->users.names) {
|
||||
free(current_info->users.names); current_info->users.names = 0;
|
||||
}
|
||||
current_info->users.names = malloc(TEXT_BUFFER_SIZE);
|
||||
strncpy(current_info->users.names, "broken", TEXT_BUFFER_SIZE);
|
||||
}
|
||||
user_num(&t);
|
||||
if (t!=0) {
|
||||
if (current_info->users.number) {
|
||||
current_info->users.number = 0;
|
||||
}
|
||||
current_info->users.number = t;
|
||||
} else {
|
||||
current_info->users.number = 0;
|
||||
}
|
||||
temp = "\0";
|
||||
user_term(&temp);
|
||||
if (temp!=NULL) {
|
||||
if (current_info->users.terms) {
|
||||
free(current_info->users.terms); current_info->users.terms = 0;
|
||||
}
|
||||
current_info->users.terms = malloc(TEXT_BUFFER_SIZE);
|
||||
strncpy(current_info->users.terms, temp, TEXT_BUFFER_SIZE);
|
||||
} else {
|
||||
if (current_info->users.terms) {
|
||||
free(current_info->users.terms); current_info->users.terms = 0;
|
||||
}
|
||||
current_info->users.terms = malloc(TEXT_BUFFER_SIZE);
|
||||
strncpy(current_info->users.terms, "broken", TEXT_BUFFER_SIZE);
|
||||
}
|
||||
user_time(&temp);
|
||||
if (temp!=NULL) {
|
||||
if (current_info->users.times) {
|
||||
free(current_info->users.times); current_info->users.times = 0;
|
||||
}
|
||||
current_info->users.times = malloc(TEXT_BUFFER_SIZE);
|
||||
strncpy(current_info->users.times, temp, TEXT_BUFFER_SIZE);
|
||||
} else {
|
||||
if (current_info->users.times) {
|
||||
free(current_info->users.times); current_info->users.times = 0;
|
||||
}
|
||||
current_info->users.times = malloc(TEXT_BUFFER_SIZE);
|
||||
strncpy(current_info->users.times, "broken", TEXT_BUFFER_SIZE);
|
||||
}
|
||||
}
|
112
src/xmms2.c
112
src/xmms2.c
@ -68,16 +68,6 @@ static void xmms_alloc(struct information *ptr)
|
||||
ptr->xmms2.comment[0] = '\0';
|
||||
}
|
||||
|
||||
if (ptr->xmms2.decoder == NULL) {
|
||||
ptr->xmms2.decoder = malloc(TEXT_BUFFER_SIZE);
|
||||
ptr->xmms2.decoder[0] = '\0';
|
||||
}
|
||||
|
||||
if (ptr->xmms2.transport == NULL) {
|
||||
ptr->xmms2.transport = malloc(TEXT_BUFFER_SIZE);
|
||||
ptr->xmms2.transport[0] = '\0';
|
||||
}
|
||||
|
||||
if (ptr->xmms2.url == NULL) {
|
||||
ptr->xmms2.url = malloc(TEXT_BUFFER_SIZE);
|
||||
ptr->xmms2.url[0] = '\0';
|
||||
@ -92,25 +82,14 @@ static void xmms_alloc(struct information *ptr)
|
||||
static void xmms_clear(struct information *ptr)
|
||||
{
|
||||
xmms_alloc(ptr);
|
||||
ptr->xmms2.status[0] = '\0';
|
||||
ptr->xmms2.artist[0] = '\0';
|
||||
ptr->xmms2.album[0] = '\0';
|
||||
ptr->xmms2.title[0] = '\0';
|
||||
ptr->xmms2.genre[0] = '\0';
|
||||
ptr->xmms2.comment[0] = '\0';
|
||||
ptr->xmms2.decoder[0] = '\0';
|
||||
ptr->xmms2.transport[0] = '\0';
|
||||
ptr->xmms2.url[0] = '\0';
|
||||
ptr->xmms2.date[0] = '\0';
|
||||
}
|
||||
|
||||
void connection_lost(void *p)
|
||||
{
|
||||
struct information *ptr = p;
|
||||
|
||||
ptr->xmms2_conn_state = CONN_NO;
|
||||
|
||||
xmms_clear(ptr);
|
||||
ptr->xmms2.tracknr = 0;
|
||||
ptr->xmms2.id = 0;
|
||||
ptr->xmms2.bitrate = 0;
|
||||
@ -118,6 +97,19 @@ void connection_lost(void *p)
|
||||
ptr->xmms2.elapsed = 0;
|
||||
ptr->xmms2.size = 0;
|
||||
ptr->xmms2.progress = 0;
|
||||
ptr->xmms2.timesplayed = -1;
|
||||
}
|
||||
|
||||
void connection_lost(void *p)
|
||||
{
|
||||
struct information *ptr = p;
|
||||
ptr->xmms2_conn_state = CONN_NO;
|
||||
|
||||
fprintf(stderr,"Conky: xmms2 connection failed. %s\n",
|
||||
xmmsc_get_last_error ( ptr->xmms2_conn ));
|
||||
fflush(stderr);
|
||||
|
||||
xmms_clear(ptr);
|
||||
}
|
||||
|
||||
void handle_curent_id(xmmsc_result_t *res, void *p)
|
||||
@ -174,20 +166,6 @@ void handle_curent_id(xmmsc_result_t *res, void *p)
|
||||
strncpy(ptr->xmms2.comment, "", TEXT_BUFFER_SIZE - 1);
|
||||
}
|
||||
|
||||
xmmsc_result_get_dict_entry_string(res2, "decoder", &temp);
|
||||
if (temp != NULL) {
|
||||
strncpy(ptr->xmms2.decoder, temp, TEXT_BUFFER_SIZE - 1);
|
||||
} else {
|
||||
strncpy(ptr->xmms2.decoder, "[Unknown]", TEXT_BUFFER_SIZE - 1);
|
||||
}
|
||||
|
||||
xmmsc_result_get_dict_entry_string(res2, "transport", &temp);
|
||||
if (temp != NULL) {
|
||||
strncpy(ptr->xmms2.transport, temp, TEXT_BUFFER_SIZE - 1);
|
||||
} else {
|
||||
strncpy(ptr->xmms2.transport, "[Unknown]", TEXT_BUFFER_SIZE - 1);
|
||||
}
|
||||
|
||||
xmmsc_result_get_dict_entry_string(res2, "url", &temp);
|
||||
if (temp != NULL) {
|
||||
strncpy(ptr->xmms2.url, temp, TEXT_BUFFER_SIZE - 1);
|
||||
@ -216,6 +194,9 @@ void handle_curent_id(xmmsc_result_t *res, void *p)
|
||||
xmmsc_result_get_dict_entry_int(res2, "size", &itemp);
|
||||
ptr->xmms2.size = (float) itemp / 1048576;
|
||||
|
||||
xmmsc_result_get_dict_entry_int( res2, "timesplayed", &itemp );
|
||||
ptr->xmms2.timesplayed = itemp;
|
||||
|
||||
xmmsc_result_unref(res2);
|
||||
}
|
||||
}
|
||||
@ -269,6 +250,20 @@ void handle_playback_state_change(xmmsc_result_t *res, void *p)
|
||||
}
|
||||
}
|
||||
|
||||
void handle_playlist_loaded(xmmsc_result_t *res, void *p) {
|
||||
struct information *ptr = p;
|
||||
|
||||
if (ptr->xmms2.playlist == NULL) {
|
||||
ptr->xmms2.playlist = malloc(TEXT_BUFFER_SIZE);
|
||||
ptr->xmms2.playlist[0] = '\0';
|
||||
}
|
||||
|
||||
if (!xmmsc_result_get_string(res, &ptr->xmms2.playlist)) {
|
||||
ptr->xmms2.playlist[0] = '\0';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void update_xmms2()
|
||||
{
|
||||
struct information *current_info = &info;
|
||||
@ -283,7 +278,7 @@ void update_xmms2()
|
||||
/* did init fail? */
|
||||
if (current_info->xmms2_conn == NULL) {
|
||||
fprintf(stderr, "Conky: xmms2 init failed. %s\n",
|
||||
xmmsc_get_last_error(current_info->xmms2_conn));
|
||||
xmmsc_get_last_error(current_info->xmms2_conn));
|
||||
fflush(stderr);
|
||||
return;
|
||||
}
|
||||
@ -294,14 +289,6 @@ void update_xmms2()
|
||||
/* clear all values */
|
||||
xmms_clear(current_info);
|
||||
|
||||
current_info->xmms2.tracknr = 0;
|
||||
current_info->xmms2.id = 0;
|
||||
current_info->xmms2.bitrate = 0;
|
||||
current_info->xmms2.duration = 0;
|
||||
current_info->xmms2.elapsed = 0;
|
||||
current_info->xmms2.size = 0;
|
||||
current_info->xmms2.progress = 0;
|
||||
|
||||
/* fprintf(stderr, "Conky: xmms2 init ok.\n");
|
||||
fflush(stderr); */
|
||||
}
|
||||
@ -322,8 +309,6 @@ void update_xmms2()
|
||||
/* set callbacks */
|
||||
xmmsc_disconnect_callback_set(current_info->xmms2_conn, connection_lost,
|
||||
current_info);
|
||||
XMMS_CALLBACK_SET(current_info->xmms2_conn, xmmsc_playback_current_id,
|
||||
handle_curent_id, current_info);
|
||||
XMMS_CALLBACK_SET(current_info->xmms2_conn,
|
||||
xmmsc_broadcast_playback_current_id, handle_curent_id,
|
||||
current_info);
|
||||
@ -332,32 +317,17 @@ void update_xmms2()
|
||||
XMMS_CALLBACK_SET(current_info->xmms2_conn,
|
||||
xmmsc_broadcast_playback_status, handle_playback_state_change,
|
||||
current_info);
|
||||
XMMS_CALLBACK_SET(current_info->xmms2_conn,
|
||||
xmmsc_broadcast_playlist_loaded, handle_playlist_loaded,
|
||||
current_info);
|
||||
|
||||
/* get playback status, it wont be broadcasted untill it chages */
|
||||
xmmsc_result_t *res = xmmsc_playback_status(current_info->xmms2_conn);
|
||||
|
||||
xmmsc_result_wait(res);
|
||||
unsigned int pb_state;
|
||||
|
||||
xmmsc_result_get_uint(res, &pb_state);
|
||||
switch (pb_state) {
|
||||
case XMMS_PLAYBACK_STATUS_PLAY:
|
||||
strncpy(current_info->xmms2.status, "Playing",
|
||||
TEXT_BUFFER_SIZE - 1);
|
||||
break;
|
||||
case XMMS_PLAYBACK_STATUS_PAUSE:
|
||||
strncpy(current_info->xmms2.status, "Paused",
|
||||
TEXT_BUFFER_SIZE - 1);
|
||||
break;
|
||||
case XMMS_PLAYBACK_STATUS_STOP:
|
||||
strncpy(current_info->xmms2.status, "Stopped",
|
||||
TEXT_BUFFER_SIZE - 1);
|
||||
break;
|
||||
default:
|
||||
strncpy(current_info->xmms2.status, "Unknown",
|
||||
TEXT_BUFFER_SIZE - 1);
|
||||
}
|
||||
xmmsc_result_unref(res);
|
||||
/* get playback status, current id and active playlist */
|
||||
XMMS_CALLBACK_SET(current_info->xmms2_conn,
|
||||
xmmsc_playback_current_id, handle_curent_id, current_info);
|
||||
XMMS_CALLBACK_SET(current_info->xmms2_conn,
|
||||
xmmsc_playback_status, handle_playback_state_change, current_info);
|
||||
XMMS_CALLBACK_SET(current_info->xmms2_conn,
|
||||
xmmsc_playlist_current_active, handle_playlist_loaded, current_info);
|
||||
|
||||
/* everything seems to be ok */
|
||||
current_info->xmms2_conn_state = CONN_OK;
|
||||
|
Loading…
Reference in New Issue
Block a user