diff --git a/ChangeLog b/ChangeLog index 290e4f17..7a699936 100644 --- a/ChangeLog +++ b/ChangeLog @@ -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: diff --git a/README b/README index 1d5b287b..6662cd90 100644 --- a/README +++ b/README @@ -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 diff --git a/doc/conky.1 b/doc/conky.1 index 0f4234a5..b3273645 100644 --- a/doc/conky.1 +++ b/doc/conky.1 @@ -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. diff --git a/doc/variables.xml b/doc/variables.xml index ab14f1c7..a3648552 100644 --- a/doc/variables.xml +++ b/doc/variables.xml @@ -1116,6 +1116,20 @@ + + + + + + + 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. + + + diff --git a/extras/nano/conky.nanorc b/extras/nano/conky.nanorc index b9849c93..41834c7c 100644 --- a/extras/nano/conky.nanorc +++ b/extras/nano/conky.nanorc @@ -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_!@#$*?-]+\}?" diff --git a/extras/vim/syntax/conkyrc.vim b/extras/vim/syntax/conkyrc.vim index 2901a520..a314bf96 100644 --- a/extras/vim/syntax/conkyrc.vim +++ b/extras/vim/syntax/conkyrc.vim @@ -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 diff --git a/src/conky.c b/src/conky.c index 17380405..72f2406a 100644 --- a/src/conky.c +++ b/src/conky.c @@ -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); } diff --git a/src/text_object.h b/src/text_object.h index d87f5971..9d1975df 100644 --- a/src/text_object.h +++ b/src/text_object.h @@ -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;