1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2025-01-12 19:06:36 +00:00

if_updatenr added

This commit is contained in:
Nikolas Garofil 2009-03-01 15:10:01 +01:00
parent a9a59e5d28
commit 09ac943a3a
8 changed files with 45 additions and 1 deletions

View File

@ -1,3 +1,6 @@
2009-03-01
* Added if_updatenr
2009-02-17
* Added $battery_short patch, sf.net id #2300911 (thanks Swoog)
* Patch by Kim Holviala sf.net id #2484548:

10
README
View File

@ -1041,6 +1041,16 @@ conky(1) conky(1)
and the matching $endif
1mif_updatenr (updatenr)0m
If it's the UPDATENR-th time that conky updates, display every-
thing between $if_updatenr and the matching $endif. The counter
resets when the highest UPDATENR is reached.
Example : "{$if_updatenr 1}foo$endif{$if_updatenr 2}bar$endif
{$if_updatenr 4}$endif" shows foo 25% of the time followed by
bar 25% of the time followed by nothing the other half of the
time.
1mimap_messages (args)0m
Displays the number of messages in your global IMAP inbox by de
fault. You can define individual IMAP inboxes seperately by

View File

@ -907,6 +907,10 @@ $if_smapi_bat_installed and the matching $endif
\fB\*(T<\fBif_up\fR\*(T>\fR \*(T<\fB(interface)\fR\*(T>
if INTERFACE exists and is up, display everything between $if_up and the matching $endif
.TP
\fB\*(T<\fBif_updatenr\fR\*(T>\fR \*(T<\fB(updatenr)\fR\*(T>
If it's the UPDATENR-th time that conky updates, display everything between $if_updatenr and the matching $endif. The counter resets when the highest UPDATENR is reached. Example : "{$if_updatenr 1}foo$endif{$if_updatenr 2}bar$endif{$if_updatenr 4}$endif" shows foo 25% of the time followed by bar 25% of the time followed by nothing the other half of the time.
.TP
\fB\*(T<\fBimap_messages\fR\*(T>\fR \*(T<\fB(args)\fR\*(T>
Displays the number of 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] [-r retries]". Default port is 143, default interval is 5 minutes, and default number of retries before giving up is 5. If the password is supplied as '*', you will be prompted to enter the password when Conky starts.

View File

@ -1116,6 +1116,20 @@
<para></para></listitem>
</varlistentry>
<varlistentry>
<term>
<command><option>if_updatenr</option></command>
<option>(updatenr)</option>
</term>
<listitem>
If it's the UPDATENR-th time that conky updates,
display everything between $if_updatenr and the matching $endif.
The counter resets when the highest UPDATENR is reached.
Example : "{$if_updatenr 1}foo$endif{$if_updatenr 2}bar$endif{$if_updatenr 4}$endif"
shows foo 25% of the time followed by bar 25% of the time followed by nothing the other half of the time.
<para></para></listitem>
</varlistentry>
<varlistentry>
<term>
<command><option>imap_messages</option></command>

View File

@ -11,7 +11,7 @@ color green "\<(alignment|background|show_graph_range|show_graph_scale|border_ma
color yellow "\<(above|below|bottom_left|bottom_right|bottom_middle|desktop|dock|no|none|normal|override|skip_pager|skip_taskbar|sticky|top_left|top_right|top_middle|middle_left|middle_right|undecorated|yes)\>"
## Variables
color brightblue "\<(acpitemp|acpitempf|freq|freq_g|voltage_mv|voltage_v|wireless_essid|wireless_mode|wireless_bitrate|wireless_ap|wireless_link_qual|wireless_link_qual_max|wireless_link_qual_perc|wireless_link_bar|freq_dyn|freq_dyn_g|adt746xcpu|adt746xfan|acpifan|acpiacadapter|battery|battery_time|battery_percent|battery_bar|buffers|cached|cpu|cpubar|cpugraph|loadgraph|lines|color|color0|color1|color2|color3|color4|color5|color6|color7|color8|color9|conky_version|conky_build_date|conky_build_arch|disk_protect|i8k_version|i8k_bios|i8k_serial|i8k_cpu_temp|i8k_cpu_tempf|i8k_left_fan_status|i8k_right_fan_status|i8k_left_fan_rpm|i8k_right_fan_rpm|i8k_ac_status|i8k_buttons_status|ibm_fan|ibm_temps|ibm_volume|ibm_brightness|if_up|if_gw|gw_iface|gw_ip|laptop_mode|pb_battery|obsd_sensors_temp|obsd_sensors_fan|obsd_sensors_volt|obsd_vendor|obsd_product|font|diskio|diskio_write|diskio_read|diskiograph|diskiograph_read|diskiograph_write|downspeed|downspeedf|downspeedgraph|else|endif|addr|addrs|image|exec|execp|execbar|execgraph|execibar|execigraph|execi|execpi|texeci|imap_unseen|imap_messages|pop3_unseen|pop3_used|fs_bar|fs_free|fs_free_perc|fs_size|fs_type|fs_used|fs_bar_free|fs_used_perc|loadavg|goto|tab|hr|nameserver|rss|hddtemp|offset|voffset|i2c|platform|hwmon|alignr|alignc|if_empty|if_existing|if_mounted|if_running|ioscheduler|kernel|machine|mem|memeasyfree|memfree|memmax|memperc|membar|memgraph|mixer|mixerl|mixerr|mixerbar|mixerlbar|mixerrbar|mails|mboxscan|new_mails|nodename|outlinecolor|processes|running_processes|scroll|shadecolor|stippled_hr|swap|swapmax|swapperc|swapbar|sysname|time|utime|tztime|totaldown|totalup|updates|upspeed|upspeedf|upspeedgraph|uptime_short|uptime|user_names|user_terms|user_times|user_number|apm_adapter|apm_battery_life|apm_battery_time|monitor|monitor_number|mpd_title|mpd_artist|mpd_album|mpd_random|mpd_repeat|mpd_track|mpd_name|mpd_file|mpd_vol|mpd_bitrate|mpd_status|mpd_elapsed|mpd_length|mpd_percent|mpd_bar|mpd_smart|words|xmms2_artist|xmms2_album|xmms2_title|xmms2_genre|xmms2_comment|xmms2_url|xmms2_status|xmms2_date|xmms2_tracknr|xmms2_bitrate|xmms2_id|xmms2_size|xmms2_elapsed|xmms2_duration|xmms2_percent|xmms2_bar|xmms2_playlist|xmms2_timesplayed|xmms2_smart|audacious_status|audacious_title|audacious_length|audacious_length_seconds|audacious_position|audacious_position_seconds|audacious_bitrate|audacious_frequency|audacious_channels|audacious_filename|audacious_playlist_length|audacious_playlist_position|audacious_bar|bmpx_title|bmpx_artist|bmpx_album|bmpx_uri|bmpx_track|bmpx_bitrate|top|top_mem|tail|head|tcp_portmon|iconv_start|iconv_stop|entropy_avail|entropy_poolsize|entropy_bar|smapi|if_smapi_bat_installed|smapi_bat_perc|smapi_bat_bar)\>"
color brightblue "\<(acpitemp|acpitempf|freq|freq_g|voltage_mv|voltage_v|wireless_essid|wireless_mode|wireless_bitrate|wireless_ap|wireless_link_qual|wireless_link_qual_max|wireless_link_qual_perc|wireless_link_bar|freq_dyn|freq_dyn_g|adt746xcpu|adt746xfan|acpifan|acpiacadapter|battery|battery_time|battery_percent|battery_bar|buffers|cached|cpu|cpubar|cpugraph|loadgraph|lines|color|color0|color1|color2|color3|color4|color5|color6|color7|color8|color9|conky_version|conky_build_date|conky_build_arch|disk_protect|i8k_version|i8k_bios|i8k_serial|i8k_cpu_temp|i8k_cpu_tempf|i8k_left_fan_status|i8k_right_fan_status|i8k_left_fan_rpm|i8k_right_fan_rpm|i8k_ac_status|i8k_buttons_status|ibm_fan|ibm_temps|ibm_volume|ibm_brightness|if_up|if_updatenr|if_gw|gw_iface|gw_ip|laptop_mode|pb_battery|obsd_sensors_temp|obsd_sensors_fan|obsd_sensors_volt|obsd_vendor|obsd_product|font|diskio|diskio_write|diskio_read|diskiograph|diskiograph_read|diskiograph_write|downspeed|downspeedf|downspeedgraph|else|endif|addr|addrs|image|exec|execp|execbar|execgraph|execibar|execigraph|execi|execpi|texeci|imap_unseen|imap_messages|pop3_unseen|pop3_used|fs_bar|fs_free|fs_free_perc|fs_size|fs_type|fs_used|fs_bar_free|fs_used_perc|loadavg|goto|tab|hr|nameserver|rss|hddtemp|offset|voffset|i2c|platform|hwmon|alignr|alignc|if_empty|if_existing|if_mounted|if_running|ioscheduler|kernel|machine|mem|memeasyfree|memfree|memmax|memperc|membar|memgraph|mixer|mixerl|mixerr|mixerbar|mixerlbar|mixerrbar|mails|mboxscan|new_mails|nodename|outlinecolor|processes|running_processes|scroll|shadecolor|stippled_hr|swap|swapmax|swapperc|swapbar|sysname|time|utime|tztime|totaldown|totalup|updates|upspeed|upspeedf|upspeedgraph|uptime_short|uptime|user_names|user_terms|user_times|user_number|apm_adapter|apm_battery_life|apm_battery_time|monitor|monitor_number|mpd_title|mpd_artist|mpd_album|mpd_random|mpd_repeat|mpd_track|mpd_name|mpd_file|mpd_vol|mpd_bitrate|mpd_status|mpd_elapsed|mpd_length|mpd_percent|mpd_bar|mpd_smart|words|xmms2_artist|xmms2_album|xmms2_title|xmms2_genre|xmms2_comment|xmms2_url|xmms2_status|xmms2_date|xmms2_tracknr|xmms2_bitrate|xmms2_id|xmms2_size|xmms2_elapsed|xmms2_duration|xmms2_percent|xmms2_bar|xmms2_playlist|xmms2_timesplayed|xmms2_smart|audacious_status|audacious_title|audacious_length|audacious_length_seconds|audacious_position|audacious_position_seconds|audacious_bitrate|audacious_frequency|audacious_channels|audacious_filename|audacious_playlist_length|audacious_playlist_position|audacious_bar|bmpx_title|bmpx_artist|bmpx_album|bmpx_uri|bmpx_track|bmpx_bitrate|top|top_mem|tail|head|tcp_portmon|iconv_start|iconv_stop|entropy_avail|entropy_poolsize|entropy_bar|smapi|if_smapi_bat_installed|smapi_bat_perc|smapi_bat_bar)\>"
color brightblue "\$\{?[0-9A-Z_!@#$*?-]+\}?"

View File

@ -195,6 +195,7 @@ syn keyword ConkyrcVarName contained nextgroup=ConkyrcNumber,ConkyrcColour skipw
\ ibm_volume
\ ibm_brightness
\ if_up
\ if_updatenr
\ if_gw
\ gw_iface
\ gw_ip

View File

@ -361,6 +361,7 @@ static char *global_text = 0;
long global_text_lines;
static int total_updates;
static int updatereset;
int check_contains(char *f, char *s)
{
@ -2157,6 +2158,10 @@ static struct text_object *construct_text_object(const char *s,
CRIT_ERR("totalup needs argument");
}
END OBJ(updates, 0)
END OBJ_IF(if_updatenr, 0)
obj->data.ifblock.i = arg ? atoi(arg) : 0;
if(obj->data.ifblock.i == 0) CRIT_ERR("if_updatenr needs a number above 0 as argument");
updatereset = obj->data.ifblock.i > updatereset ? obj->data.ifblock.i : updatereset;
END OBJ(alignr, 0)
obj->data.i = arg ? atoi(arg) : 0;
END OBJ(alignc, 0)
@ -4177,6 +4182,11 @@ static void generate_text_internal(char *p, int p_max_size,
OBJ(updates) {
snprintf(p, p_max_size, "%d", total_updates);
}
OBJ(if_updatenr) {
if(total_updates % updatereset != obj->data.ifblock.i - 1) {
DO_JUMP;
}
}
OBJ(upspeed) {
human_readable(obj->data.net->trans_speed, p, 255);
}

View File

@ -167,6 +167,7 @@ enum text_object_type {
OBJ_if_existing,
OBJ_if_mounted,
OBJ_if_running,
OBJ_if_updatenr,
OBJ_top,
OBJ_top_mem,
OBJ_top_time,
@ -409,6 +410,7 @@ struct text_object {
struct {
struct text_object *next;
char *s;
int i;
char *str;
} ifblock;