1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-11-16 01:57:09 +00:00

Added format_human_readable option (sf.net #2803345, thanks Vincent).

This commit is contained in:
Vincent Breitmoser 2009-06-09 14:52:18 -06:00 committed by Brenden Matthews
parent c392152d3a
commit f3aa025872
6 changed files with 29 additions and 5 deletions

View File

@ -1,3 +1,6 @@
2009-06-09
* Added format_human_readable option (sf.net #2803345, thanks Vincent)
2009-06-08
* $battery_short can now also display F (full), N (not present),E (empty),
U (unknown)

View File

@ -238,6 +238,17 @@
nice font
<para /></listitem>
</varlistentry>
<varlistentry>
<term>
<command>
<option>format_human_readable</option>
</command>
</term>
<listitem>If enabled, values which are in bytes will be
printed in human readable format (i.e., KiB, MiB, etc). If
disabled, the number of bytes is printed instead.
<para /></listitem>
</varlistentry>
<varlistentry>
<term>
<command>

View File

@ -433,9 +433,9 @@
<listitem>Battery status and remaining percentage capacity
of ACPI or APM battery. ACPI battery number can be given as
argument (default is BAT0). This mode display a short
status, which means that C is displayed instead of charging,
D for discharging, F for full, N for not present, E for empty
and U for unknown.
status, which means that C is displayed instead of
charging, D for discharging, F for full, N for not present,
E for empty and U for unknown.
<para /></listitem>
</varlistentry>
<varlistentry>

View File

@ -5,7 +5,7 @@
syntax "conky" "(\.*conkyrc.*$|conky.conf)"
## Configuration items
color green "\<(alias|alignment|append_file|background|border_margin|border_width|color0|color1|color2|color3|color4|color5|color6|color7|color8|color9|colorN|cpu_avg_samples|default_bar_size|default_color|default_gauge_size|default_graph_size|default_outline_color|default_shade_color|diskio_avg_samples|display|double_buffer|draw_borders|draw_graph_borders|draw_outline|draw_shades|font|gap_x|gap_y|if_up_strictness|imap|imlib_cache_flush_interval|imlib_cache_size|lua_load|mail_spool|max_port_monitor_connections|max_specials|max_user_text|maximum_width|minimum_size|mpd_host|mpd_password|mpd_port|music_player_interval|net_avg_samples|no_buffers|out_to_console|out_to_stderr|out_to_x|override_utf8_locale|overwrite_file|own_window|own_window_class|own_window_colour|own_window_hints|own_window_title|own_window_transparent|own_window_type|pad_percents|pop3|sensor_device|short_units|show_graph_range|show_graph_scale|stippled_borders|temperature_unit|template|template0|template1|template2|template3|template4|template5|template6|template7|template8|template9|text|text_buffer_size|top_cpu_separate|top_name_width|total_run_times|update_interval|uppercase|use_spacer|use_xft|xftalpha|xftfont)\>"
color green "\<(alias|alignment|append_file|background|border_margin|border_width|color0|color1|color2|color3|color4|color5|color6|color7|color8|color9|colorN|cpu_avg_samples|default_bar_size|default_color|default_gauge_size|default_graph_size|default_outline_color|default_shade_color|diskio_avg_samples|display|double_buffer|draw_borders|draw_graph_borders|draw_outline|draw_shades|font|format_human_readable|gap_x|gap_y|if_up_strictness|imap|imlib_cache_flush_interval|imlib_cache_size|lua_load|mail_spool|max_port_monitor_connections|max_specials|max_user_text|maximum_width|minimum_size|mpd_host|mpd_password|mpd_port|music_player_interval|net_avg_samples|no_buffers|out_to_console|out_to_stderr|out_to_x|override_utf8_locale|overwrite_file|own_window|own_window_class|own_window_colour|own_window_hints|own_window_title|own_window_transparent|own_window_type|pad_percents|pop3|sensor_device|short_units|show_graph_range|show_graph_scale|stippled_borders|temperature_unit|template|template0|template1|template2|template3|template4|template5|template6|template7|template8|template9|text|text_buffer_size|top_cpu_separate|top_name_width|total_run_times|update_interval|uppercase|use_spacer|use_xft|xftalpha|xftfont)\>"
## Configuration item constants
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)\>"

View File

@ -12,7 +12,7 @@ endif
syn region ConkyrcComment start=/^\s*#/ end=/$/
syn keyword ConkyrcSetting alias alignment append_file background border_margin border_width color0 color1 color2 color3 color4 color5 color6 color7 color8 color9 colorN cpu_avg_samples default_bar_size default_color default_gauge_size default_graph_size default_outline_color default_shade_color diskio_avg_samples display double_buffer draw_borders draw_graph_borders draw_outline draw_shades font gap_x gap_y if_up_strictness imap imlib_cache_flush_interval imlib_cache_size lua_load mail_spool max_port_monitor_connections max_specials max_user_text maximum_width minimum_size mpd_host mpd_password mpd_port music_player_interval net_avg_samples no_buffers out_to_console out_to_stderr out_to_x override_utf8_locale overwrite_file own_window own_window_class own_window_colour own_window_hints own_window_title own_window_transparent own_window_type pad_percents pop3 sensor_device short_units show_graph_range show_graph_scale stippled_borders temperature_unit template template0 template1 template2 template3 template4 template5 template6 template7 template8 template9 text text_buffer_size top_cpu_separate top_name_width total_run_times update_interval uppercase use_spacer use_xft xftalpha xftfont
syn keyword ConkyrcSetting alias alignment append_file background border_margin border_width color0 color1 color2 color3 color4 color5 color6 color7 color8 color9 colorN cpu_avg_samples default_bar_size default_color default_gauge_size default_graph_size default_outline_color default_shade_color diskio_avg_samples display double_buffer draw_borders draw_graph_borders draw_outline draw_shades font format_human_readable gap_x gap_y if_up_strictness imap imlib_cache_flush_interval imlib_cache_size lua_load mail_spool max_port_monitor_connections max_specials max_user_text maximum_width minimum_size mpd_host mpd_password mpd_port music_player_interval net_avg_samples no_buffers out_to_console out_to_stderr out_to_x override_utf8_locale overwrite_file own_window own_window_class own_window_colour own_window_hints own_window_title own_window_transparent own_window_type pad_percents pop3 sensor_device short_units show_graph_range show_graph_scale stippled_borders temperature_unit template template0 template1 template2 template3 template4 template5 template6 template7 template8 template9 text text_buffer_size top_cpu_separate top_name_width total_run_times update_interval uppercase use_spacer use_xft xftalpha xftfont
syn keyword ConkyrcConstant
\ above

View File

@ -131,6 +131,7 @@ static char *tmpstring1, *tmpstring2;
/* variables holding various config settings */
int short_units;
int format_human_readable;
int cpu_separate;
enum {
NO_SPACER = 0,
@ -559,6 +560,11 @@ static void human_readable(long long num, char *buf, int size)
int width;
const char *format;
/* Possibly just output as usual, for example for stdout usage */
if (!format_human_readable) {
spaced_print(buf, size, "%d", 6, round_to_int(num));
return;
}
if (short_units) {
width = 5;
format = "%.*f%.1s";
@ -7412,6 +7418,7 @@ static void set_default_configurations(void)
top_cpu = 0;
cpu_separate = 0;
short_units = 0;
format_human_readable = 1;
top_mem = 0;
top_time = 0;
#ifdef MPD
@ -8122,6 +8129,9 @@ static void load_config_file(const char *f)
CONF("short_units") {
short_units = string_to_bool(value);
}
CONF("format_human_readable") {
format_human_readable = string_to_bool(value);
}
CONF("pad_percents") {
pad_percents = atoi(value);
}