mirror of
https://github.com/Llewellynvdm/conky.git
synced 2025-01-23 07:08:31 +00:00
Add support for max_text_width configuration setting
This commit is contained in:
parent
4c4770eb77
commit
4652e834b1
@ -1,3 +1,6 @@
|
|||||||
|
2009-11-24
|
||||||
|
* Added support for max_text_width
|
||||||
|
|
||||||
2009-11-20
|
2009-11-20
|
||||||
* Allow for mpd connections to use IPv6
|
* Allow for mpd connections to use IPv6
|
||||||
|
|
||||||
|
@ -454,6 +454,19 @@
|
|||||||
offsets, aligns, etc. (default is 512)
|
offsets, aligns, etc. (default is 512)
|
||||||
<para /></listitem>
|
<para /></listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
<varlistentry>
|
||||||
|
<term>
|
||||||
|
<command>
|
||||||
|
<option>max_text_width</option>
|
||||||
|
</command>
|
||||||
|
<option>width</option>
|
||||||
|
</term>
|
||||||
|
<listitem>When a line in the output contains 'width'
|
||||||
|
chars and the end isn't reached, the next char will start
|
||||||
|
on a new line. If you want to make sure that lines don't
|
||||||
|
get broken, set 'width' to 0
|
||||||
|
<para /></listitem>
|
||||||
|
</varlistentry>
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term>
|
<term>
|
||||||
<command>
|
<command>
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
syntax "conky" "(\.*conkyrc.*$|conky.conf)"
|
syntax "conky" "(\.*conkyrc.*$|conky.conf)"
|
||||||
|
|
||||||
## Configuration items
|
## Configuration items
|
||||||
color green "\<(alignment|append_file|background|border_inner_margin|border_outer_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|extra_newline|font|format_human_readable|gap_x|gap_y|if_up_strictness|imap|imlib_cache_flush_interval|imlib_cache_size|lua_draw_hook_post|lua_draw_hook_pre|lua_load|lua_shutdown_hook|lua_startup_hook|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_ncurses|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|update_interval_on_battery|uppercase|use_spacer|use_xft|xftalpha|xftfont)\>"
|
color green "\<(alignment|append_file|background|border_inner_margin|border_outer_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|extra_newline|font|format_human_readable|gap_x|gap_y|if_up_strictness|imap|imlib_cache_flush_interval|imlib_cache_size|lua_draw_hook_post|lua_draw_hook_pre|lua_load|lua_shutdown_hook|lua_startup_hook|mail_spool|max_port_monitor_connections|max_specials|max_text_width|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_ncurses|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|update_interval_on_battery|uppercase|use_spacer|use_xft|xftalpha|xftfont)\>"
|
||||||
|
|
||||||
## Configuration item constants
|
## 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|middle_middle|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|middle_middle|undecorated|yes)\>"
|
||||||
|
@ -12,7 +12,7 @@ endif
|
|||||||
|
|
||||||
syn region ConkyrcComment start=/^\s*#/ end=/$/
|
syn region ConkyrcComment start=/^\s*#/ end=/$/
|
||||||
|
|
||||||
syn keyword ConkyrcSetting alignment append_file background border_inner_margin border_outer_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 extra_newline font format_human_readable gap_x gap_y if_up_strictness imap imlib_cache_flush_interval imlib_cache_size lua_draw_hook_post lua_draw_hook_pre lua_load lua_shutdown_hook lua_startup_hook 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_ncurses 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 update_interval_on_battery uppercase use_spacer use_xft xftalpha xftfont
|
syn keyword ConkyrcSetting alignment append_file background border_inner_margin border_outer_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 extra_newline font format_human_readable gap_x gap_y if_up_strictness imap imlib_cache_flush_interval imlib_cache_size lua_draw_hook_post lua_draw_hook_pre lua_load lua_shutdown_hook lua_startup_hook mail_spool max_port_monitor_connections max_specials max_text_width 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_ncurses 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 update_interval_on_battery uppercase use_spacer use_xft xftalpha xftfont
|
||||||
|
|
||||||
syn keyword ConkyrcConstant
|
syn keyword ConkyrcConstant
|
||||||
\ above
|
\ above
|
||||||
|
21
src/conky.c
21
src/conky.c
@ -175,6 +175,7 @@ double update_interval;
|
|||||||
double update_interval_old;
|
double update_interval_old;
|
||||||
double update_interval_bat;
|
double update_interval_bat;
|
||||||
void *global_cpu = NULL;
|
void *global_cpu = NULL;
|
||||||
|
unsigned int max_text_width = 0;
|
||||||
|
|
||||||
int argc_copy;
|
int argc_copy;
|
||||||
char** argv_copy;
|
char** argv_copy;
|
||||||
@ -2402,6 +2403,7 @@ static void generate_text(void)
|
|||||||
{
|
{
|
||||||
struct information *cur = &info;
|
struct information *cur = &info;
|
||||||
char *p;
|
char *p;
|
||||||
|
unsigned int i, j, k;
|
||||||
|
|
||||||
special_count = 0;
|
special_count = 0;
|
||||||
|
|
||||||
@ -2418,6 +2420,22 @@ static void generate_text(void)
|
|||||||
p = text_buffer;
|
p = text_buffer;
|
||||||
|
|
||||||
generate_text_internal(p, max_user_text, global_root_object, cur);
|
generate_text_internal(p, max_user_text, global_root_object, cur);
|
||||||
|
if(max_text_width > 0) {
|
||||||
|
for(i = 0, j = 0; p[i] != 0; i++) {
|
||||||
|
if(p[i] == '\n') j = 0;
|
||||||
|
else if(j == max_text_width) {
|
||||||
|
k = i + strlen(p + i) + 1;
|
||||||
|
if(k < text_buffer_size) {
|
||||||
|
while(k != i) {
|
||||||
|
p[k] = p[k-1];
|
||||||
|
k--;
|
||||||
|
}
|
||||||
|
p[k] = '\n';
|
||||||
|
j = 0;
|
||||||
|
} else NORM_ERR("The end of the text_buffer is reached, increase \"text_buffer_size\"");
|
||||||
|
} else j++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (stuff_in_uppercase) {
|
if (stuff_in_uppercase) {
|
||||||
char *tmp_p;
|
char *tmp_p;
|
||||||
@ -4718,6 +4736,9 @@ char load_config_file(const char *f)
|
|||||||
CONF("times_in_seconds") {
|
CONF("times_in_seconds") {
|
||||||
set_times_in_seconds(string_to_bool(value));
|
set_times_in_seconds(string_to_bool(value));
|
||||||
}
|
}
|
||||||
|
CONF("max_text_width") {
|
||||||
|
max_text_width = atoi(value);
|
||||||
|
}
|
||||||
CONF("out_to_console") {
|
CONF("out_to_console") {
|
||||||
if(string_to_bool(value)) {
|
if(string_to_bool(value)) {
|
||||||
output_methods |= TO_STDOUT;
|
output_methods |= TO_STDOUT;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user