mirror of
https://github.com/Llewellynvdm/conky.git
synced 2024-11-15 17:47:09 +00:00
Make minimum_{width,height} lua settings
This commit is contained in:
parent
467abd2edf
commit
ed70663b99
@ -525,11 +525,21 @@
|
||||
<varlistentry>
|
||||
<term>
|
||||
<command>
|
||||
<option>minimum_size</option>
|
||||
<option>minimum_height</option>
|
||||
</command>
|
||||
<option>width (height)</option>
|
||||
<option>height</option>
|
||||
</term>
|
||||
<listitem>Minimum size of window
|
||||
<listitem>Minimum height of the window
|
||||
<para /></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<command>
|
||||
<option>minimum_width</option>
|
||||
</command>
|
||||
<option>width</option>
|
||||
</term>
|
||||
<listitem>Minimum width of window
|
||||
<para /></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
|
@ -5,7 +5,7 @@
|
||||
syntax "conky" "(\.*conkyrc.*$|conky.conf)"
|
||||
|
||||
## 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_height|default_bar_width|default_color|default_gauge_height|default_gauge_width|default_graph_height|default_graph_width|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|http_refresh|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_text_width|max_user_text|maximum_width|minimum_size|mpd_host|mpd_password|mpd_port|music_player_interval|mysql_host|mysql_port|mysql_user|mysql_password|mysql_db|net_avg_samples|no_buffers|nvidia_display|out_to_console|out_to_http|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|times_in_seconds|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_height|default_bar_width|default_color|default_gauge_height|default_gauge_width|default_graph_height|default_graph_width|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|http_refresh|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_text_width|max_user_text|maximum_width|minimum_height|minimum_width|mpd_host|mpd_password|mpd_port|music_player_interval|mysql_host|mysql_port|mysql_user|mysql_password|mysql_db|net_avg_samples|no_buffers|nvidia_display|out_to_console|out_to_http|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|times_in_seconds|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
|
||||
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 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_height default_bar_width default_color default_gauge_height default_gauge_width default_graph_height default_graph_width 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 http_refresh 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_text_width max_user_text maximum_width minimum_size mpd_host mpd_password mpd_port music_player_interval mysql_host mysql_port mysql_user mysql_password mysql_db net_avg_samples no_buffers nvidia_display out_to_console out_to_http 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 times_in_seconds 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_height default_bar_width default_color default_gauge_height default_gauge_width default_graph_height default_graph_width 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 http_refresh 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_text_width max_user_text maximum_width minimum_height minumum_width mpd_host mpd_password mpd_port music_player_interval mysql_host mysql_port mysql_user mysql_password mysql_db net_avg_samples no_buffers nvidia_display out_to_console out_to_http 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 times_in_seconds 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
|
||||
\ above
|
||||
|
25
src/conky.cc
25
src/conky.cc
@ -441,7 +441,10 @@ static conky::simple_config_setting<bool> draw_outline("draw_outline", false, fa
|
||||
static int fixed_size = 0, fixed_pos = 0;
|
||||
#endif
|
||||
|
||||
static int minimum_width, minimum_height;
|
||||
static conky::range_config_setting<int> minimum_height("minimum_height", 0,
|
||||
std::numeric_limits<int>::max(), 5, true);
|
||||
static conky::range_config_setting<int> minimum_width("minimum_width", 0,
|
||||
std::numeric_limits<int>::max(), 5, true);
|
||||
static conky::range_config_setting<int> maximum_width("maximum_width", 0,
|
||||
std::numeric_limits<int>::max(), 0, true);
|
||||
|
||||
@ -1016,13 +1019,13 @@ static void update_text_area(void)
|
||||
if (!fixed_size)
|
||||
#endif
|
||||
{
|
||||
text_width = minimum_width;
|
||||
text_width = minimum_width.get(*state);
|
||||
text_height = 0;
|
||||
last_font_height = font_height();
|
||||
for_each_line(text_buffer, text_size_updater);
|
||||
text_width += 1;
|
||||
if (text_height < minimum_height) {
|
||||
text_height = minimum_height;
|
||||
if (text_height < minimum_height.get(*state)) {
|
||||
text_height = minimum_height.get(*state);
|
||||
}
|
||||
int mw = maximum_width.get(*state);
|
||||
if (text_width > mw && mw > 0) {
|
||||
@ -2625,8 +2628,6 @@ static void set_default_configurations(void)
|
||||
#endif
|
||||
#ifdef BUILD_X11
|
||||
set_first_font("6x10");
|
||||
minimum_width = 5;
|
||||
minimum_height = 5;
|
||||
#endif /* BUILD_X11 */
|
||||
|
||||
free(current_mail_spool);
|
||||
@ -2859,18 +2860,6 @@ char load_config_file(const char *f)
|
||||
}
|
||||
}
|
||||
#ifdef BUILD_X11
|
||||
CONF("minimum_size") {
|
||||
if (value) {
|
||||
if (sscanf(value, "%d %d", &minimum_width, &minimum_height)
|
||||
!= 2) {
|
||||
if (sscanf(value, "%d", &minimum_width) != 1) {
|
||||
CONF_ERR;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
CONF_ERR;
|
||||
}
|
||||
}
|
||||
#ifdef BUILD_IMLIB2
|
||||
CONF("imlib_cache_size") {
|
||||
if (value) {
|
||||
|
Loading…
Reference in New Issue
Block a user