1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2025-02-03 04:28:35 +00:00

Refactor some of the new weather code, fix docs.

I moved the weather stuff into its own thread, and also fixed up some
abuse of <simplelist> formatting throughout the docs.  Hopefully we can
keep things a little more uniform from now on.
This commit is contained in:
Brenden Matthews 2009-07-12 23:31:57 -06:00
parent ee64345f7c
commit e1011c0d13
15 changed files with 815 additions and 757 deletions

View File

@ -18,7 +18,7 @@
<xsl:template match="/"> <xsl:template match="/">
<html> <html>
<head> <head>
<title>Conky Variables</title> <title>Conky configuration settings</title>
</head> </head>
<body bgcolor="#FFFFFF"> <body bgcolor="#FFFFFF">
<xsl:apply-templates /> <xsl:apply-templates />
@ -40,7 +40,7 @@
<xsl:template match="member/command"> <xsl:template match="member/command">
<strong> <strong>
<xsl:value-of select="." /> <xsl:value-of select="." />
</strong> </strong> -
</xsl:template> </xsl:template>
<xsl:template match="member/option"> <xsl:template match="member/option">

View File

@ -26,60 +26,59 @@
<simplelist> <simplelist>
<member> <member>
<command>drawable</command> <command>drawable</command>
<option>- Window's drawable (Xlib <option>Window's drawable (Xlib
Drawable)</option> Drawable)</option>
</member> </member>
<member> <member>
<command>visual</command> <command>visual</command>
<option>- Window's visual (Xlib <option>Window's visual (Xlib Visual)</option>
Visual)</option>
</member> </member>
<member> <member>
<command>display</command> <command>display</command>
<option>- Window's display (Xlib <option>Window's display (Xlib
Display)</option> Display)</option>
</member> </member>
<member> <member>
<command>width</command> <command>width</command>
<option>- Window width (in pixels)</option> <option>Window width (in pixels)</option>
</member> </member>
<member> <member>
<command>height</command> <command>height</command>
<option>- Window height (in pixels)</option> <option>Window height (in pixels)</option>
</member> </member>
<member> <member>
<command>border_inner_margin</command> <command>border_inner_margin</command>
<option>- Window's inner border margin (in <option>Window's inner border margin (in
pixels)</option> pixels)</option>
</member> </member>
<member> <member>
<command>border_outer_margin</command> <command>border_outer_margin</command>
<option>- Window's outer border margin (in <option>Window's outer border margin (in
pixels)</option> pixels)</option>
</member> </member>
<member> <member>
<command>border_width</command> <command>border_width</command>
<option>- Window's border width (in <option>Window's border width (in
pixels)</option> pixels)</option>
</member> </member>
<member> <member>
<command>text_start_x</command> <command>text_start_x</command>
<option>- The x component of the starting <option>The x component of the starting
coordinate of text drawing</option> coordinate of text drawing</option>
</member> </member>
<member> <member>
<command>text_start_y</command> <command>text_start_y</command>
<option>- The y component of the starting <option>The y component of the starting
coordinate of text drawing</option> coordinate of text drawing</option>
</member> </member>
<member> <member>
<command>text_width</command> <command>text_width</command>
<option>- The width of the text drawing <option>The width of the text drawing
region</option> region</option>
</member> </member>
<member> <member>
<command>text_height</command> <command>text_height</command>
<option>- The height of the text drawing <option>The height of the text drawing
region</option> region</option>
</member> </member>
</simplelist> </simplelist>

View File

@ -18,7 +18,7 @@
<xsl:template match="member/command"> <xsl:template match="member/command">
<strong> <strong>
<xsl:value-of select="." /> <xsl:value-of select="." />
</strong> </strong> -
</xsl:template> </xsl:template>
<xsl:template match="member/option"> <xsl:template match="member/option">

View File

@ -655,7 +655,16 @@
<option>desktop</option> <option>desktop</option>
</command> </command>
</term> </term>
<listitem>Number of the desktop on which conky is running <listitem>Number of the desktop on which conky is running
<para /></listitem>
</varlistentry>
<varlistentry>
<term>
<command>
<option>desktop_name</option>
</command>
</term>
<listitem>Name of the desktop on which conky is running
<para /></listitem> <para /></listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
@ -667,15 +676,6 @@
<listitem>Number of desktops <listitem>Number of desktops
<para /></listitem> <para /></listitem>
</varlistentry> </varlistentry>
<varlistentry>
<term>
<command>
<option>desktop_name</option>
</command>
</term>
<listitem>Name of the desktop on which conky is running
<para /></listitem>
</varlistentry>
<varlistentry> <varlistentry>
<term> <term>
<command> <command>
@ -1532,13 +1532,13 @@
and right side types are: and right side types are:
<simplelist> <simplelist>
<member> <member>
<command>double</command>: argument consists of only <command>double</command>Argument consists of only
digits and a single dot.</member> digits and a single dot.</member>
<member> <member>
<command>long</command>: argument consists of only <command>long</command>Argument consists of only
digits.</member> digits.</member>
<member> <member>
<command>string</command>: argument is enclosed in <command>string</command>Argument is enclosed in
quotation mark or the checks for double and long failed quotation mark or the checks for double and long failed
before.</member> before.</member>
</simplelist>Valid operands are: '&gt;', '&lt;', '&gt;=', </simplelist>Valid operands are: '&gt;', '&lt;', '&gt;=',
@ -2360,23 +2360,29 @@
other values as integer. other values as integer.
<simplelist> <simplelist>
<member> <member>
<command>threshold</command>: the thresholdtemperature <command>threshold</command>The thresholdtemperature at
at which the gpu slows down</member> which the gpu slows down</member>
<member> <member>
<command>temp</command>: gives the gpu current <command>temp</command>Tives the gpu current
temperature</member> temperature</member>
<member> <member>
<command>ambient</command>: gives current air <command>ambient</command>
temperature near GPU case</member> <option>Gives current air temperature near GPU
case</option>
</member>
<member> <member>
<command>gpufreq</command>: gives the current gpu <command>gpufreq</command>
frequency</member> <option>Gives the current gpu frequency</option>
</member>
<member> <member>
<command>memfreq</command>: gives the current mem <command>memfreq</command>
frequency</member> <option>Gives the current mem frequency</option>
</member>
<member> <member>
<command>imagequality</command>: which imagequality <command>imagequality</command>
should be choosen by OpenGL applications</member> <option>Which imagequality should be choosen by
OpenGL applications</option>
</member>
</simplelist> </simplelist>
<para /></listitem> <para /></listitem>
</varlistentry> </varlistentry>
@ -2413,20 +2419,25 @@
must be specified. Valid items are: must be specified. Valid items are:
<simplelist> <simplelist>
<member> <member>
<command>status</command>: Display if battery is fully <command>status</command>
charged, charging, discharging or absent (running on <option>Display if battery is fully charged,
AC)</member> charging, discharging or absent (running on
AC)</option>
</member>
<member> <member>
<command>percent</command>: Display charge of battery <command>percent</command>
in percent, if charging or discharging. Nothing will be <option>Display charge of battery in percent, if
displayed, if battery is fully charged or charging or discharging. Nothing will be displayed,
absent.</member> if battery is fully charged or absent.</option>
</member>
<member> <member>
<command>time</command>: Display the time remaining <command>time</command>
until the battery will be fully charged or discharged <option>Display the time remaining until the
at current rate. Nothing is displayed, if battery is battery will be fully charged or discharged at
absent or if it's present but fully charged and not current rate. Nothing is displayed, if battery is
discharging.</member> absent or if it's present but fully charged and not
discharging.</option>
</member>
</simplelist> </simplelist>
<para /></listitem> <para /></listitem>
</varlistentry> </varlistentry>
@ -2771,68 +2782,102 @@
<option>port_begin port_end item (index)</option> <option>port_begin port_end item (index)</option>
<emphasis>(ip4 only at present)</emphasis> <emphasis>(ip4 only at present)</emphasis>
</term> </term>
<listitem>TCP port monitor for specified local ports. Port <listitem>
numbers must be in the range 1 to 65535. Valid items are: <para>TCP port monitor for specified local ports. Port
<simplelist> numbers must be in the range 1 to 65535. Valid items
<member> are:</para>
<command>count</command>- total number of connections <simplelist>
in the range</member> <member>
<member> <command>count</command>
<command>rip</command>- remote ip address</member> <option>Total number of connections in the
<member> range</option>
<command>rhost</command>- remote host name</member> </member>
<member> <member>
<command>rport</command>- remote port number</member> <command>rip</command>
<member> <option>Remote ip address</option>
<command>rservice</command>- remote service name from </member>
/etc/services</member> <member>
<member> <command>rhost</command>
<command>lip</command>- local ip address</member> <option>Remote host name</option>
<member> </member>
<command>lhost</command>- local host name</member> <member>
<member> <command>rport</command>
<command>lport</command>- local port number</member> <option>Remote port number</option>
<member> </member>
<command>lservice</command>- local service name from <member>
/etc/services</member> <command>rservice</command>
</simplelist>The connection index provides you with access <option>Remote service name from
to each connection in the port monitor. The monitor will /etc/services</option>
return information for index values from 0 to n-1 </member>
connections. Values higher than n-1 are simply ignored. For <member>
the "count" item, the connection index must be omitted. It <command>lip</command>
is required for all other items. <option>Local ip address</option>
<simplelist> </member>
<member>Examples:</member> <member>
<member> <command>lhost</command>
<command>${tcp_portmon 6881 6999 count}</command>- <option>Local host name</option>
displays the number of connections in the bittorrent </member>
port range</member> <member>
<member> <command>lport</command>
<command>${tcp_portmon 22 22 rip 0}</command>- displays <option>Local port number</option>
the remote host ip of the first sshd </member>
connection</member> <member>
<member> <command>lservice</command>
<command>${tcp_portmon 22 22 rip 9}</command>- displays <option>Local service name from
the remote host ip of the tenth sshd /etc/services</option>
connection</member> </member>
<member> </simplelist>
<command>${tcp_portmon 1 1024 rhost 0}</command>- <para>The connection index provides you with access to
displays the remote host name of the first connection each connection in the port monitor. The monitor will
on a privileged port</member> return information for index values from 0 to n-1
<member> connections. Values higher than n-1 are simply ignored.
<command>${tcp_portmon 1 1024 rport 4}</command>- For the "count" item, the connection index must be
displays the remote host port of the fifth connection omitted. It is required for all other items.</para>
on a privileged port</member> <para>Examples:</para>
<member> <simplelist>
<command>${tcp_portmon 1 65535 lservice 14}</command>- <member>
displays the local service name of the fifteenth <command>${tcp_portmon 6881 6999
connection in the range of all ports</member> count}</command>
</simplelist>Note that port monitor variables which share <option>Displays the number of connections in
the same port range actually refer to the same monitor, so the bittorrent port range</option>
many references to a single port range for different items </member>
and different indexes all use the same monitor internally. <member>
In other words, the program avoids creating redundant <command>${tcp_portmon 22 22 rip 0}</command>
monitors.</listitem> <option>Displays the remote host ip of the
first sshd connection</option>
</member>
<member>
<command>${tcp_portmon 22 22 rip 9}</command>
<option>Displays the remote host ip of the
tenth sshd connection</option>
</member>
<member>
<command>${tcp_portmon 1 1024 rhost
0}</command>
<option>Displays the remote host name of the
first connection on a privileged port</option>
</member>
<member>
<command>${tcp_portmon 1 1024 rport
4}</command>
<option>Displays the remote host port of the
fifth connection on a privileged port</option>
</member>
<member>
<command>${tcp_portmon 1 65535 lservice
14}</command>
<option>Displays the local service name of the
fifteenth connection in the range of all
ports</option>
</member>
</simplelist>
<para>Note that port monitor variables which share the
same port range actually refer to the same monitor, so
many references to a single port range for different
items and different indexes all use the same monitor
internally. In other words, the program avoids creating
redundant monitors.</para>
</listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term>
@ -2843,59 +2888,63 @@
<option>(arg2)</option> <option>(arg2)</option>
<option>(arg3 ...)</option> <option>(arg3 ...)</option>
</term> </term>
<listitem>Evaluate the content of the templateN <listitem>
configuration variable (where N is a value between 0 and 9, <para>Evaluate the content of the templateN
inclusively), applying substitutions as described in the configuration variable (where N is a value between 0
documentation of the corresponding configuration variable. and 9, inclusively), applying substitutions as
The number of arguments is optional, but must match the described in the documentation of the corresponding
highest referred index in the template. You can use the configuration variable. The number of arguments is
same special sequences in each argument as the ones valid optional, but must match the highest referred index in
for a template definition, e.g. to allow an argument to the template. You can use the same special sequences in
contain a whitespace. Also simple nesting of templates is each argument as the ones valid for a template
possible this way. definition, e.g. to allow an argument to contain a
<para /></listitem> whitespace. Also simple nesting of templates is
<listitem>Here are some examples of template definitions: possible this way.</para>
<simplelist> <para>Here are some examples of template
<member>template0 $\1\2</member> definitions:</para>
<member>template1 \1: ${fs_used \2} / ${fs_size <simplelist>
\2}</member> <member>template0 $\1\2</member>
<member>template2 \1 \2</member> <member>template1 \1: ${fs_used \2} / ${fs_size
</simplelist>The following list shows sample usage of the \2}</member>
templates defined above, with the equivalent syntax when <member>template2 \1 \2</member>
not using any template at all: </simplelist>
<table> <para>The following list shows sample usage of the
<tgroup cols="2"> templates defined above, with the equivalent syntax
<thead> when not using any template at all:</para>
<row rowsep="1"> <table>
<entry>using template</entry> <tgroup cols="2">
<entry>same without template</entry> <thead>
</row> <row rowsep="1">
</thead> <entry>using template</entry>
<tbody> <entry>same without template</entry>
<row> </row>
<entry>${template0 node name}</entry> </thead>
<entry>$nodename</entry> <tbody>
</row> <row>
<row> <entry>${template0 node name}</entry>
<entry>${template1 root /}</entry> <entry>$nodename</entry>
<entry>root: ${fs_free /} / ${fs_size </row>
/}</entry> <row>
</row> <entry>${template1 root /}</entry>
<row> <entry>root: ${fs_free /} / ${fs_size
<entry> /}</entry>
<programlisting>${template1 </row>
${template2\ disk\ root} <row>
/}</programlisting> <entry>
</entry> <programlisting>${template1
<entry> ${template2\ disk\ root}
<programlisting>disk root: ${fs_free /} /}</programlisting>
/ ${fs_size /}</programlisting> </entry>
</entry> <entry>
</row> <programlisting>disk root:
</tbody> ${fs_free /} / ${fs_size
</tgroup> /}</programlisting>
</table> </entry>
<para /></listitem> </row>
</tbody>
</tgroup>
</table>
</listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term>
@ -3236,26 +3285,61 @@
<command> <command>
<option>weather</option> <option>weather</option>
</command> </command>
<option>icao data_type (delay_in_minutes)</option> <option>URI icao data_type (delay_in_minutes)</option>
</term> </term>
<listitem>Download, parse and display METAR data from the <listitem>
NWS. icao must be a valid icao for the required location <para>Download, parse and display METAR data from the
(see for instance NWS. icao must be a valid icao for the required
https://pilotweb.nas.faa.gov/qryhtml/icao/). data_type must location (see for instance
be one of the following: last_update (display the date https://pilotweb.nas.faa.gov/qryhtml/icao/). For the URI, you can use any METAR source, but a good example is http://weather.noaa.gov/pub/data/observations/metar/stations/ (from the US NOAA).</para>
(yyyy/mm/dd) and time (UTC) of the last update), <para>'data_type' must be one of the following:</para>
temperature_C (display air temperature in degree Celsius), <simplelist>
temperature_F (display air temperature in degree <member>
Fahrenheit), cloud_cover (display the highest cloud cover <command>last_update</command>
status), pressure (display air pressure in millibar), <option>The date (yyyy/mm/dd) and time (UTC) of
wind_speed (display wind speed in km/hour), wind_dir the last update</option>
(display wind direction), wind_dir_DEG (display compass </member>
wind direction), humidity (display relative humidity in %), <member>
weather (display any relevant weather event (rain, snow, <command>temperature</command>
etc.)). delay_in_minutes (optional, default 30) cannot be <option>Air temperature (you can use the
lower than 30 min. Up to 3 stations can be simultaneously 'temperature_unit' config setting to change
queried. Note that this feature is still EXPERIMENTAL. units)</option>
<para /></listitem> </member>
<member>
<command>cloud_cover</command>
<option>The highest cloud cover status</option>
</member>
<member>
<command>pressurer</command>
<option>Air pressure in millibar</option>
</member>
<member>
<command>wind_speed</command>
<option>Wind speed in km/h</option>
</member>
<member>
<command>wind_dir</command>
<option>Wind direction</option>
</member>
<member>
<command>wind_dir_DEG</command>
<option>Compass wind direction</option>
</member>
<member>
<command>humidity</command>
<option>Relative humidity in %</option>
</member>
<member>
<command>weather</command>
<option>Any relevant weather event (rain, snow,
etc.))</option>
</member>
</simplelist>
<para>delay_in_minutes (optional, default 30) cannot be
lower than 30 min. Up to 3 stations can be
simultaneously queried. Note that this feature is still
EXPERIMENTAL.</para>
</listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term>

View File

@ -18,7 +18,7 @@
<xsl:template match="/"> <xsl:template match="/">
<html> <html>
<head> <head>
<title>Lua API</title> <title>Conky Objects</title>
</head> </head>
<body bgcolor="#FFFFFF"> <body bgcolor="#FFFFFF">
<xsl:apply-templates /> <xsl:apply-templates />
@ -29,7 +29,7 @@
<xsl:template match="member/command"> <xsl:template match="member/command">
<strong> <strong>
<xsl:value-of select="." /> <xsl:value-of select="." />
</strong> </strong> -
</xsl:template> </xsl:template>
<xsl:template match="member/option"> <xsl:template match="member/option">

View File

@ -11,7 +11,7 @@ color green "\<(alias|alignment|append_file|background|border_inner_margin|borde
color yellow "\<(above|below|bottom_left|bottom_right|bottom_middle|desktop|dock|no|none|normal|override|skip_pager|skip_taskbar|sticky|top_left|top_right|top_middle|middle_left|middle_right|undecorated|yes)\>" color yellow "\<(above|below|bottom_left|bottom_right|bottom_middle|desktop|dock|no|none|normal|override|skip_pager|skip_taskbar|sticky|top_left|top_right|top_middle|middle_left|middle_right|undecorated|yes)\>"
## Variables ## Variables
color brightblue "\<(acpiacadapter|acpifan|acpitemp|addr|addrs|adt746xcpu|adt746xfan|alignc|alignr|apcupsd|apcupsd_cable|apcupsd_charge|apcupsd_lastxfer|apcupsd_linev|apcupsd_load|apcupsd_loadbar|apcupsd_loadgauge|apcupsd_loadgraph|apcupsd_model|apcupsd_name|apcupsd_status|apcupsd_temp|apcupsd_timeleft|apcupsd_upsmode|apm_adapter|apm_battery_life|apm_battery_time|audacious_bar|audacious_bitrate|audacious_channels|audacious_filename|audacious_frequency|audacious_length|audacious_length_seconds|audacious_main_volume|audacious_playlist_length|audacious_playlist_position|audacious_position|audacious_position_seconds|audacious_status|audacious_title|battery|battery_bar|battery_percent|battery_short|battery_time|blink|bmpx_album|bmpx_artist|bmpx_bitrate|bmpx_title|bmpx_track|bmpx_uri|buffers|cached|color|color0|color1|color2|color3|color4|color5|color6|color7|color8|color9|combine|conky_build_arch|conky_build_date|conky_version|cpu|cpubar|cpugauge|cpugraph|desktop|desktop_number|desktop_name|disk_protect|diskio|diskio_read|diskio_write|diskiograph|diskiograph_read|diskiograph_write|downspeed|downspeedf|downspeedgraph|draft_mails|else|endif|entropy_avail|entropy_bar|entropy_perc|entropy_poolsize|eval|eve|exec|execbar|execgauge|execgraph|execi|execibar|execigauge|execigraph|execp|execpi|flagged_mails|font|forwarded_mails|freq|freq_g|fs_bar|fs_bar_free|fs_free|fs_free_perc|fs_size|fs_type|fs_used|fs_used_perc|goto|gw_iface|gw_ip|hddtemp|head|hr|hwmon|i2c|i8k_ac_status|i8k_bios|i8k_buttons_status|i8k_cpu_temp|i8k_left_fan_rpm|i8k_left_fan_status|i8k_right_fan_rpm|i8k_right_fan_status|i8k_serial|i8k_version|ibm_brightness|ibm_fan|ibm_temps|ibm_volume|iconv_start|iconv_stop|if_empty|if_existing|if_gw|if_match|if_mixer_mute|if_mounted|if_mpd_playing|if_running|if_smapi_bat_installed|if_up|if_updatenr|if_xmms2_connected|image|imap_messages|imap_unseen|ioscheduler|kernel|laptop_mode|lines|loadavg|loadgraph|lua|lua_bar|lua_gauge|lua_graph|lua_parse|machine|mails|mboxscan|mem|membar|memeasyfree|memfree|memgauge|memgraph|memmax|memperc|mixer|mixerbar|mixerl|mixerlbar|mixerr|mixerrbar|moc_album|moc_artist|moc_bitrate|moc_curtime|moc_file|moc_rate|moc_song|moc_state|moc_timeleft|moc_title|moc_totaltime|monitor|monitor_number|mpd_album|mpd_artist|mpd_bar|mpd_bitrate|mpd_elapsed|mpd_file|mpd_length|mpd_name|mpd_percent|mpd_random|mpd_repeat|mpd_smart|mpd_status|mpd_title|mpd_track|mpd_vol|nameserver|new_mails|nodename|nvidia|obsd_product|obsd_sensors_fan|obsd_sensors_temp|obsd_sensors_volt|obsd_vendor|offset|outlinecolor|pb_battery|platform|pop3_unseen|pop3_used|pre_exec|processes|read_tcp|replied_mails|rss|running_processes|scroll|seen_mails|shadecolor|smapi|smapi_bat_bar|smapi_bat_perc|smapi_bat_power|smapi_bat_temp|sony_fanspeed|stippled_hr|swap|swapbar|swapfree|swapmax|swapperc|sysname|tab|tail|tcp_portmon|template0|template1|template2|template3|template4|template5|template6|template7|template8|template9|texeci|time|to_bytes|top|top_io|top_mem|top_time|totaldown|totalup|trashed_mails|tztime|unflagged_mails|unforwarded_mails|unreplied_mails|unseen_mails|updates|upspeed|upspeedf|upspeedgraph|uptime|uptime_short|user_names|user_number|user_terms|user_times|utime|voffset|voltage_mv|voltage_v|weather|wireless_ap|wireless_bitrate|wireless_essid|wireless_link_bar|wireless_link_qual|wireless_link_qual_max|wireless_link_qual_perc|wireless_mode|words|xmms2_album|xmms2_artist|xmms2_bar|xmms2_bitrate|xmms2_comment|xmms2_date|xmms2_duration|xmms2_elapsed|xmms2_genre|xmms2_id|xmms2_percent|xmms2_playlist|xmms2_size|xmms2_smart|xmms2_status|xmms2_timesplayed|xmms2_title|xmms2_tracknr|xmms2_url)\>" color brightblue "\<(acpiacadapter|acpifan|acpitemp|addr|addrs|adt746xcpu|adt746xfan|alignc|alignr|apcupsd|apcupsd_cable|apcupsd_charge|apcupsd_lastxfer|apcupsd_linev|apcupsd_load|apcupsd_loadbar|apcupsd_loadgauge|apcupsd_loadgraph|apcupsd_model|apcupsd_name|apcupsd_status|apcupsd_temp|apcupsd_timeleft|apcupsd_upsmode|apm_adapter|apm_battery_life|apm_battery_time|audacious_bar|audacious_bitrate|audacious_channels|audacious_filename|audacious_frequency|audacious_length|audacious_length_seconds|audacious_main_volume|audacious_playlist_length|audacious_playlist_position|audacious_position|audacious_position_seconds|audacious_status|audacious_title|battery|battery_bar|battery_percent|battery_short|battery_time|blink|bmpx_album|bmpx_artist|bmpx_bitrate|bmpx_title|bmpx_track|bmpx_uri|buffers|cached|color|color0|color1|color2|color3|color4|color5|color6|color7|color8|color9|combine|conky_build_arch|conky_build_date|conky_version|cpu|cpubar|cpugauge|cpugraph|desktop|desktop_name|desktop_number|disk_protect|diskio|diskio_read|diskio_write|diskiograph|diskiograph_read|diskiograph_write|downspeed|downspeedf|downspeedgraph|draft_mails|else|endif|entropy_avail|entropy_bar|entropy_perc|entropy_poolsize|eval|eve|exec|execbar|execgauge|execgraph|execi|execibar|execigauge|execigraph|execp|execpi|flagged_mails|font|forwarded_mails|freq|freq_g|fs_bar|fs_bar_free|fs_free|fs_free_perc|fs_size|fs_type|fs_used|fs_used_perc|goto|gw_iface|gw_ip|hddtemp|head|hr|hwmon|i2c|i8k_ac_status|i8k_bios|i8k_buttons_status|i8k_cpu_temp|i8k_left_fan_rpm|i8k_left_fan_status|i8k_right_fan_rpm|i8k_right_fan_status|i8k_serial|i8k_version|ibm_brightness|ibm_fan|ibm_temps|ibm_volume|iconv_start|iconv_stop|if_empty|if_existing|if_gw|if_match|if_mixer_mute|if_mounted|if_mpd_playing|if_running|if_smapi_bat_installed|if_up|if_updatenr|if_xmms2_connected|image|imap_messages|imap_unseen|ioscheduler|kernel|laptop_mode|lines|loadavg|loadgraph|lua|lua_bar|lua_gauge|lua_graph|lua_parse|machine|mails|mboxscan|mem|membar|memeasyfree|memfree|memgauge|memgraph|memmax|memperc|mixer|mixerbar|mixerl|mixerlbar|mixerr|mixerrbar|moc_album|moc_artist|moc_bitrate|moc_curtime|moc_file|moc_rate|moc_song|moc_state|moc_timeleft|moc_title|moc_totaltime|monitor|monitor_number|mpd_album|mpd_artist|mpd_bar|mpd_bitrate|mpd_elapsed|mpd_file|mpd_length|mpd_name|mpd_percent|mpd_random|mpd_repeat|mpd_smart|mpd_status|mpd_title|mpd_track|mpd_vol|nameserver|new_mails|nodename|nvidia|obsd_product|obsd_sensors_fan|obsd_sensors_temp|obsd_sensors_volt|obsd_vendor|offset|outlinecolor|pb_battery|platform|pop3_unseen|pop3_used|pre_exec|processes|read_tcp|replied_mails|rss|running_processes|scroll|seen_mails|shadecolor|smapi|smapi_bat_bar|smapi_bat_perc|smapi_bat_power|smapi_bat_temp|sony_fanspeed|stippled_hr|swap|swapbar|swapfree|swapmax|swapperc|sysname|tab|tail|tcp_portmon|template0|template1|template2|template3|template4|template5|template6|template7|template8|template9|texeci|time|to_bytes|top|top_io|top_mem|top_time|totaldown|totalup|trashed_mails|tztime|unflagged_mails|unforwarded_mails|unreplied_mails|unseen_mails|updates|upspeed|upspeedf|upspeedgraph|uptime|uptime_short|user_names|user_number|user_terms|user_times|utime|voffset|voltage_mv|voltage_v|weather|wireless_ap|wireless_bitrate|wireless_essid|wireless_link_bar|wireless_link_qual|wireless_link_qual_max|wireless_link_qual_perc|wireless_mode|words|xmms2_album|xmms2_artist|xmms2_bar|xmms2_bitrate|xmms2_comment|xmms2_date|xmms2_duration|xmms2_elapsed|xmms2_genre|xmms2_id|xmms2_percent|xmms2_playlist|xmms2_size|xmms2_smart|xmms2_status|xmms2_timesplayed|xmms2_title|xmms2_tracknr|xmms2_url)\>"
color brightblue "\$\{?[0-9A-Z_!@#$*?-]+\}?" color brightblue "\$\{?[0-9A-Z_!@#$*?-]+\}?"
color cyan "(\{|\}|\(|\)|\;|\]|\[|`|\\|\$|<|>|!|=|&|\|)" color cyan "(\{|\}|\(|\)|\;|\]|\[|`|\\|\$|<|>|!|=|&|\|)"

View File

@ -49,7 +49,7 @@ syn region ConkyrcVar start=/\$\w\@=/ end=/\W\@=\|$/ contained contains=ConkyrcV
syn match ConkyrcVarStuff /{\@<=/ms=s contained nextgroup=ConkyrcVarName syn match ConkyrcVarStuff /{\@<=/ms=s contained nextgroup=ConkyrcVarName
syn keyword ConkyrcVarName contained nextgroup=ConkyrcNumber,ConkyrcColour skipwhite acpiacadapter acpifan acpitemp addr addrs adt746xcpu adt746xfan alignc alignr apcupsd apcupsd_cable apcupsd_charge apcupsd_lastxfer apcupsd_linev apcupsd_load apcupsd_loadbar apcupsd_loadgauge apcupsd_loadgraph apcupsd_model apcupsd_name apcupsd_status apcupsd_temp apcupsd_timeleft apcupsd_upsmode apm_adapter apm_battery_life apm_battery_time audacious_bar audacious_bitrate audacious_channels audacious_filename audacious_frequency audacious_length audacious_length_seconds audacious_main_volume audacious_playlist_length audacious_playlist_position audacious_position audacious_position_seconds audacious_status audacious_title battery battery_bar battery_percent battery_short battery_time blink bmpx_album bmpx_artist bmpx_bitrate bmpx_title bmpx_track bmpx_uri buffers cached color color0 color1 color2 color3 color4 color5 color6 color7 color8 color9 combine conky_build_arch conky_build_date conky_version cpu cpubar cpugauge cpugraph desktop desktop_number desktop_name disk_protect diskio diskio_read diskio_write diskiograph diskiograph_read diskiograph_write downspeed downspeedf downspeedgraph draft_mails else endif entropy_avail entropy_bar entropy_perc entropy_poolsize eval eve exec execbar execgauge execgraph execi execibar execigauge execigraph execp execpi flagged_mails font forwarded_mails freq freq_g fs_bar fs_bar_free fs_free fs_free_perc fs_size fs_type fs_used fs_used_perc goto gw_iface gw_ip hddtemp head hr hwmon i2c i8k_ac_status i8k_bios i8k_buttons_status i8k_cpu_temp i8k_left_fan_rpm i8k_left_fan_status i8k_right_fan_rpm i8k_right_fan_status i8k_serial i8k_version ibm_brightness ibm_fan ibm_temps ibm_volume iconv_start iconv_stop if_empty if_existing if_gw if_match if_mixer_mute if_mounted if_mpd_playing if_running if_smapi_bat_installed if_up if_updatenr if_xmms2_connected image imap_messages imap_unseen ioscheduler kernel laptop_mode lines loadavg loadgraph lua lua_bar lua_gauge lua_graph lua_parse machine mails mboxscan mem membar memeasyfree memfree memgauge memgraph memmax memperc mixer mixerbar mixerl mixerlbar mixerr mixerrbar moc_album moc_artist moc_bitrate moc_curtime moc_file moc_rate moc_song moc_state moc_timeleft moc_title moc_totaltime monitor monitor_number mpd_album mpd_artist mpd_bar mpd_bitrate mpd_elapsed mpd_file mpd_length mpd_name mpd_percent mpd_random mpd_repeat mpd_smart mpd_status mpd_title mpd_track mpd_vol nameserver new_mails nodename nvidia obsd_product obsd_sensors_fan obsd_sensors_temp obsd_sensors_volt obsd_vendor offset outlinecolor pb_battery platform pop3_unseen pop3_used pre_exec processes read_tcp replied_mails rss running_processes scroll seen_mails shadecolor smapi smapi_bat_bar smapi_bat_perc smapi_bat_power smapi_bat_temp sony_fanspeed stippled_hr swap swapbar swapfree swapmax swapperc sysname tab tail tcp_portmon template0 template1 template2 template3 template4 template5 template6 template7 template8 template9 texeci time to_bytes top top_io top_mem top_time totaldown totalup trashed_mails tztime unflagged_mails unforwarded_mails unreplied_mails unseen_mails updates upspeed upspeedf upspeedgraph uptime uptime_short user_names user_number user_terms user_times utime voffset voltage_mv voltage_v weather wireless_ap wireless_bitrate wireless_essid wireless_link_bar wireless_link_qual wireless_link_qual_max wireless_link_qual_perc wireless_mode words xmms2_album xmms2_artist xmms2_bar xmms2_bitrate xmms2_comment xmms2_date xmms2_duration xmms2_elapsed xmms2_genre xmms2_id xmms2_percent xmms2_playlist xmms2_size xmms2_smart xmms2_status xmms2_timesplayed xmms2_title xmms2_tracknr xmms2_url syn keyword ConkyrcVarName contained nextgroup=ConkyrcNumber,ConkyrcColour skipwhite acpiacadapter acpifan acpitemp addr addrs adt746xcpu adt746xfan alignc alignr apcupsd apcupsd_cable apcupsd_charge apcupsd_lastxfer apcupsd_linev apcupsd_load apcupsd_loadbar apcupsd_loadgauge apcupsd_loadgraph apcupsd_model apcupsd_name apcupsd_status apcupsd_temp apcupsd_timeleft apcupsd_upsmode apm_adapter apm_battery_life apm_battery_time audacious_bar audacious_bitrate audacious_channels audacious_filename audacious_frequency audacious_length audacious_length_seconds audacious_main_volume audacious_playlist_length audacious_playlist_position audacious_position audacious_position_seconds audacious_status audacious_title battery battery_bar battery_percent battery_short battery_time blink bmpx_album bmpx_artist bmpx_bitrate bmpx_title bmpx_track bmpx_uri buffers cached color color0 color1 color2 color3 color4 color5 color6 color7 color8 color9 combine conky_build_arch conky_build_date conky_version cpu cpubar cpugauge cpugraph desktop desktop_name desktop_number disk_protect diskio diskio_read diskio_write diskiograph diskiograph_read diskiograph_write downspeed downspeedf downspeedgraph draft_mails else endif entropy_avail entropy_bar entropy_perc entropy_poolsize eval eve exec execbar execgauge execgraph execi execibar execigauge execigraph execp execpi flagged_mails font forwarded_mails freq freq_g fs_bar fs_bar_free fs_free fs_free_perc fs_size fs_type fs_used fs_used_perc goto gw_iface gw_ip hddtemp head hr hwmon i2c i8k_ac_status i8k_bios i8k_buttons_status i8k_cpu_temp i8k_left_fan_rpm i8k_left_fan_status i8k_right_fan_rpm i8k_right_fan_status i8k_serial i8k_version ibm_brightness ibm_fan ibm_temps ibm_volume iconv_start iconv_stop if_empty if_existing if_gw if_match if_mixer_mute if_mounted if_mpd_playing if_running if_smapi_bat_installed if_up if_updatenr if_xmms2_connected image imap_messages imap_unseen ioscheduler kernel laptop_mode lines loadavg loadgraph lua lua_bar lua_gauge lua_graph lua_parse machine mails mboxscan mem membar memeasyfree memfree memgauge memgraph memmax memperc mixer mixerbar mixerl mixerlbar mixerr mixerrbar moc_album moc_artist moc_bitrate moc_curtime moc_file moc_rate moc_song moc_state moc_timeleft moc_title moc_totaltime monitor monitor_number mpd_album mpd_artist mpd_bar mpd_bitrate mpd_elapsed mpd_file mpd_length mpd_name mpd_percent mpd_random mpd_repeat mpd_smart mpd_status mpd_title mpd_track mpd_vol nameserver new_mails nodename nvidia obsd_product obsd_sensors_fan obsd_sensors_temp obsd_sensors_volt obsd_vendor offset outlinecolor pb_battery platform pop3_unseen pop3_used pre_exec processes read_tcp replied_mails rss running_processes scroll seen_mails shadecolor smapi smapi_bat_bar smapi_bat_perc smapi_bat_power smapi_bat_temp sony_fanspeed stippled_hr swap swapbar swapfree swapmax swapperc sysname tab tail tcp_portmon template0 template1 template2 template3 template4 template5 template6 template7 template8 template9 texeci time to_bytes top top_io top_mem top_time totaldown totalup trashed_mails tztime unflagged_mails unforwarded_mails unreplied_mails unseen_mails updates upspeed upspeedf upspeedgraph uptime uptime_short user_names user_number user_terms user_times utime voffset voltage_mv voltage_v weather wireless_ap wireless_bitrate wireless_essid wireless_link_bar wireless_link_qual wireless_link_qual_max wireless_link_qual_perc wireless_mode words xmms2_album xmms2_artist xmms2_bar xmms2_bitrate xmms2_comment xmms2_date xmms2_duration xmms2_elapsed xmms2_genre xmms2_id xmms2_percent xmms2_playlist xmms2_size xmms2_smart xmms2_status xmms2_timesplayed xmms2_title xmms2_tracknr xmms2_url
hi def link ConkyrcComment Comment hi def link ConkyrcComment Comment
hi def link ConkyrcSetting Keyword hi def link ConkyrcSetting Keyword

View File

@ -512,3 +512,21 @@ unsigned int round_to_int(float f)
return 0; return 0;
} }
} }
/* utility function used by RSS and Weather stuff for a curl callback.
*/
size_t WriteMemoryCallback(void *ptr, size_t size, size_t nmemb, void *data)
{
size_t realsize = size * nmemb;
struct MemoryStruct *mem = (struct MemoryStruct *) data;
mem->memory = (char *) realloc(mem->memory, mem->size + realsize + 1);
if (mem->memory) {
memcpy(&(mem->memory[mem->size]), ptr, realsize);
mem->size += realsize;
mem->memory[mem->size] = 0;
}
return realsize;
}

View File

@ -89,4 +89,14 @@ int get_battery_perct(const char *bat);
int get_battery_perct_bar(const char *bat); int get_battery_perct_bar(const char *bat);
void get_battery_short_status(char *buf, unsigned int n, const char *bat); void get_battery_short_status(char *buf, unsigned int n, const char *bat);
/*
* used by RSS and Weather
*/
struct MemoryStruct {
char *memory;
size_t size;
};
size_t WriteMemoryCallback(void *ptr, size_t size, size_t nmemb, void *data);
#endif /* _COMMON_H */ #endif /* _COMMON_H */

View File

@ -2814,37 +2814,35 @@ static struct text_object *construct_text_object(const char *s,
#ifdef WEATHER #ifdef WEATHER
END OBJ(weather, 0) END OBJ(weather, 0)
if (arg) { if (arg) {
int argc, delay; int argc, interval;
char *icao = (char *) malloc(5 * sizeof(char)); char *icao = (char *) malloc(5 * sizeof(char));
char *uri = (char *) malloc(128 * sizeof(char)); char *uri = (char *) malloc(128 * sizeof(char));
char *data_type = (char *) malloc(32 * sizeof(char)); char *data_type = (char *) malloc(32 * sizeof(char));
char *tmp_p; char *tmp_p;
argc = sscanf(arg, "%4s %31s %d", icao, data_type, &delay); argc = sscanf(arg, "%127s %4s %31s %d", uri, icao, data_type, &interval);
//icao MUST BE upper-case //icao MUST BE upper-case
tmp_p = icao; tmp_p = icao;
while (*tmp_p) { while (*tmp_p) {
*tmp_p = toupper(*tmp_p); *tmp_p = toupper(*tmp_p);
tmp_p++; tmp_p++;
} }
strcpy(uri, "http://weather.noaa.gov/pub/data/observations/metar/stations/");
strcat(uri, icao); strcat(uri, icao);
strcat(uri, ".TXT"); strcat(uri, ".TXT");
obj->data.weather.uri = uri; obj->data.weather.uri = uri;
obj->data.weather.data_type = data_type; obj->data.weather.data_type = data_type;
//The data retrieval interval is limited to half an hour // The data retrieval interval is limited to half an hour
if(delay < 30) { if (interval < 30) {
delay = 30; interval = 30;
} }
obj->data.weather.delay = delay*60; obj->data.weather.interval = interval * 60; // convert to seconds
init_weather_info();
} else { } else {
CRIT_ERR("weather needs arguments: <icao> <data_type> [delay in minutes]"); CRIT_ERR("weather needs arguments: <uri> <icao> <data_type> [interval in minutes]");
} }
#endif #endif
#ifdef HAVE_LUA #ifdef HAVE_LUA
@ -4639,87 +4637,7 @@ static void generate_text_internal(char *p, int p_max_size,
#endif #endif
#ifdef WEATHER #ifdef WEATHER
OBJ(weather) { OBJ(weather) {
PWEATHER *data = get_weather_info(obj->data.weather.uri, obj->data.weather.delay); process_weather_info(p, p_max_size, obj->data.weather.uri, obj->data.weather.data_type, obj->data.weather.interval);
static const char *wc[18] =
{"", "drizzle", "rain", "hail", "soft hail",
"snow", "snow grains", "fog", "haze", "smoke",
"mist", "dust", "sand", "funnel cloud tornado",
"dust/sand", "squall", "sand storm", "dust storm"};
if (data == NULL) {
strncpy(p, "Error reading weather data", p_max_size);
} else {
if (strcmp(obj->data.weather.data_type, "last_update") == EQUAL) {
strncpy(p, data->lastupd, p_max_size);
} else if (strcmp(obj->data.weather.data_type, "temperature_C") == EQUAL) {
snprintf(p, p_max_size, "%d", data->tmpC);
} else if (strcmp(obj->data.weather.data_type, "temperature_F") == EQUAL) {
snprintf(p, p_max_size, "%d", data->tmpF);
} else if (strcmp(obj->data.weather.data_type, "cloud_cover") == EQUAL) {
if (data->cc == 0) {
strncpy(p, "", p_max_size);
} else if (data->cc < 3) {
strncpy(p, "clear", p_max_size);
} else if (data->cc < 5) {
strncpy(p, "partly cloudy", p_max_size);
} else if (data->cc == 5) {
strncpy(p, "cloudy", p_max_size);
} else if (data->cc == 6) {
strncpy(p, "overcast", p_max_size);
} else if (data->cc == 7) {
strncpy(p, "towering cumulus", p_max_size);
} else {
strncpy(p, "cumulonimbus", p_max_size);
}
} else if (strcmp(obj->data.weather.data_type, "pressure") == EQUAL) {
snprintf(p, p_max_size, "%d", data->bar);
} else if (strcmp(obj->data.weather.data_type, "wind_speed") == EQUAL) {
snprintf(p, p_max_size, "%d", data->wind_s);
} else if (strcmp(obj->data.weather.data_type, "wind_dir") == EQUAL) {
if ((data->wind_d >= 349) || (data->wind_d < 12)) {
strncpy(p, "N", p_max_size);
} else if (data->wind_d < 33) {
strncpy(p, "NNE", p_max_size);
} else if (data->wind_d < 57) {
strncpy(p, "NE", p_max_size);
} else if (data->wind_d < 79) {
strncpy(p, "ENE", p_max_size);
} else if (data->wind_d < 102) {
strncpy(p, "E", p_max_size);
} else if (data->wind_d < 124) {
strncpy(p, "ESE", p_max_size);
} else if (data->wind_d < 147) {
strncpy(p, "SE", p_max_size);
} else if (data->wind_d < 169) {
strncpy(p, "SSE", p_max_size);
} else if (data->wind_d < 192) {
strncpy(p, "S", p_max_size);
} else if (data->wind_d < 214) {
strncpy(p, "SSW", p_max_size);
} else if (data->wind_d < 237) {
strncpy(p, "SW", p_max_size);
} else if (data->wind_d < 259) {
strncpy(p, "WSW", p_max_size);
} else if (data->wind_d < 282) {
strncpy(p, "W", p_max_size);
} else if (data->wind_d < 304) {
strncpy(p, "WNW", p_max_size);
} else if (data->wind_d < 327) {
strncpy(p, "NW", p_max_size);
} else if (data->wind_d < 349) {
strncpy(p, "NNW", p_max_size);
};
} else if (strcmp(obj->data.weather.data_type, "wind_dir_DEG") == EQUAL) {
snprintf(p, p_max_size, "%d", data->wind_d);
} else if (strcmp(obj->data.weather.data_type, "humidity") == EQUAL) {
snprintf(p, p_max_size, "%d", data->hmid);
} else if (strcmp(obj->data.weather.data_type, "weather") == EQUAL) {
strncpy(p, wc[data->wc], p_max_size);
}
}
} }
#endif #endif
#ifdef HAVE_LUA #ifdef HAVE_LUA
@ -7485,6 +7403,12 @@ static void reload_config(void)
tcp_portmon_clear(); tcp_portmon_clear();
#endif #endif
#ifdef RSS
free_rss_info();
#endif
#ifdef WEATHER
free_weather_info();
#endif
#ifdef HAVE_LUA #ifdef HAVE_LUA
llua_close(); llua_close();
#endif /* HAVE_LUA */ #endif /* HAVE_LUA */

View File

@ -1,8 +1,4 @@
/* Conky, a system monitor, based on torsmo /* 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 * Please see COPYING for details
* *
@ -36,11 +32,6 @@
#define MAX_FEEDS 16 #define MAX_FEEDS 16
struct MemoryStruct {
char *memory;
size_t size;
};
typedef struct feed_ { typedef struct feed_ {
char *uri; char *uri;
int last_update; int last_update;
@ -50,20 +41,6 @@ typedef struct feed_ {
int num_feeds = 0; int num_feeds = 0;
feed feeds[MAX_FEEDS]; feed feeds[MAX_FEEDS];
size_t WriteMemoryCallback(void *ptr, size_t size, size_t nmemb, void *data)
{
size_t realsize = size * nmemb;
struct MemoryStruct *mem = (struct MemoryStruct *) data;
mem->memory = (char *) realloc(mem->memory, mem->size + realsize + 1);
if (mem->memory) {
memcpy(&(mem->memory[mem->size]), ptr, realsize);
mem->size += realsize;
mem->memory[mem->size] = 0;
}
return realsize;
}
int rss_delay(int *wait_time, int delay) int rss_delay(int *wait_time, int delay)
{ {
time_t now = time(NULL); time_t now = time(NULL);

View File

@ -30,20 +30,17 @@
/* default to output in celsius */ /* default to output in celsius */
static enum TEMP_UNIT output_unit = TEMP_CELSIUS; static enum TEMP_UNIT output_unit = TEMP_CELSIUS;
static double static double fahrenheit_to_celsius(double n)
fahrenheit_to_celsius(double n)
{ {
return ((n - 32) * 5 / 9); return ((n - 32) * 5 / 9);
} }
static double static double celsius_to_fahrenheit(double n)
celsius_to_fahrenheit(double n)
{ {
return ((n * 9 / 5) + 32); return ((n * 9 / 5) + 32);
} }
int int set_temp_output_unit(const char *name)
set_temp_output_unit(const char *name)
{ {
long i; long i;
int rc = 0; int rc = 0;
@ -66,8 +63,7 @@ set_temp_output_unit(const char *name)
return rc; return rc;
} }
static double static double convert_temp_output(double n, enum TEMP_UNIT input_unit)
convert_temp_output(double n, enum TEMP_UNIT input_unit)
{ {
if (input_unit == output_unit) if (input_unit == output_unit)
return n; return n;

View File

@ -545,13 +545,15 @@ struct text_object {
int act_par; int act_par;
int delay; int delay;
unsigned int nrspaces; unsigned int nrspaces;
timed_thread *p_timed_thread;
} rss; } rss;
#endif #endif
#ifdef WEATHER #ifdef WEATHER
struct { struct {
char *uri; char *uri;
char *data_type; char *data_type;
int delay; int interval;
timed_thread *p_timed_thread;
} weather; } weather;
#endif #endif
struct { struct {

File diff suppressed because it is too large Load Diff

View File

@ -31,8 +31,7 @@
/* WEATHER data */ /* WEATHER data */
typedef struct PWEATHER_ { typedef struct PWEATHER_ {
char lastupd[17]; char lastupd[17];
int tmpC; int temp;
int tmpF;
int dew; int dew;
int cc; int cc;
int bar; int bar;
@ -43,8 +42,8 @@ typedef struct PWEATHER_ {
} PWEATHER; } PWEATHER;
/* Prototypes */ /* Prototypes */
PWEATHER *get_weather_info(char *uri, int delay);
void init_weather_info(void); void init_weather_info(void);
void free_weather_info(void); void free_weather_info(void);
void process_weather_info(char *p, int p_max_size, char *uri, char *data_type, int interval);
#endif /*WEATHER_H_*/ #endif /*WEATHER_H_*/