1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-12-26 04:17:33 +00:00

Added top_name_width config option.

This commit is contained in:
Brenden Matthews 2009-05-07 17:49:32 -06:00
parent 72a90b38be
commit fdadbbf98e
6 changed files with 28 additions and 2 deletions

View File

@ -1,5 +1,6 @@
2009-05-07
* Fix occasional cpubar segfaults
* Added top_name_width config option
2009-05-05
* Added some completely pointless OpenMP optimizations(?)

4
README
View File

@ -197,6 +197,10 @@ conky(1) conky(1)
The number of samples to average for disk I/O monitoring.
top_name_width
Width for $top name value (defaults to 15 characters).
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

View File

@ -55,6 +55,13 @@
<para></para></listitem>
</varlistentry>
<varlistentry>
<term><command><option>top_name_width</option></command></term>
<listitem>
Width for $top name value (defaults to 15 characters).
<para></para></listitem>
</varlistentry>
<varlistentry>
<term><command><option>top_cpu_separate</option></command></term>
<listitem>

View File

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

@ -70,6 +70,7 @@ syn keyword ConkyrcSetting
\ minimum_size
\ maximum_width
\ no_buffers
\ top_name_width
\ top_cpu_separate
\ short_units
\ pad_percents

View File

@ -131,6 +131,7 @@ enum {
RIGHT_SPACER
} use_spacer;
int top_cpu, top_mem, top_time;
static unsigned int top_name_width = 15;
int output_methods;
enum x_initialiser_state x_initialised = NO;
static volatile int g_signal_pending;
@ -4701,7 +4702,7 @@ static void generate_text_internal(char *p, int p_max_size,
switch (obj->data.top.type) {
case TOP_NAME:
snprintf(p, 16, "%-15s",
snprintf(p, top_name_width + 1, "%-*s", top_name_width,
needed[obj->data.top.num]->name);
break;
case TOP_CPU:
@ -7133,6 +7134,18 @@ static void load_config_file(const char *f)
CONF("no_buffers") {
no_buffers = string_to_bool(value);
}
CONF("top_name_width") {
if (value) {
if (sscanf(value, "%u", &top_name_width) != 1) {
CONF_ERR;
}
} else {
CONF_ERR;
}
if (top_name_width >= max_user_text) {
top_name_width = max_user_text - 1;
}
}
CONF("top_cpu_separate") {
cpu_separate = string_to_bool(value);
}