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

Make default_gauge_{width,height} lua settings

This commit is contained in:
Pavel Labath 2010-08-26 17:26:34 +02:00
parent 184afe1555
commit 467abd2edf
6 changed files with 22 additions and 30 deletions

View File

@ -126,13 +126,21 @@
<varlistentry>
<term>
<command>
<option>default_gauge_size</option>
<option>default_gauge_height</option>
</command>
</term>
<listitem>Specify a default width and height for gauges.
Example: 'default_gauge_size 25 25'. This is particularly
useful for execgauge and execigauge as they do not take
size arguments
<listitem>Specify a default height for gauges. This is particularly useful for execgauge
and execigauge as they do not take size arguments
<para /></listitem>
</varlistentry>
<varlistentry>
<term>
<command>
<option>default_gauge_width</option>
</command>
</term>
<listitem>Specify a default width for gauges. This is particularly useful for execgauge
and execigauge as they do not take size arguments
<para /></listitem>
</varlistentry>
<varlistentry>

View File

@ -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_size|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_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)\>"
## 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)\>"

View File

@ -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_size 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_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 ConkyrcConstant
\ above

View File

@ -2797,21 +2797,6 @@ char load_config_file(const char *f)
CONF_ERR;
}
}
#ifdef BUILD_X11
CONF("default_gauge_size") {
char err = 0;
if (value) {
if (sscanf(value, "%d %d", &default_gauge_width, &default_gauge_height) != 2) {
err = 1;
}
} else {
err = 1;
}
if (err) {
CONF_ERR2("default_gauge_size takes 2 integer arguments (ie. 'default_gauge_size 0 6')")
}
}
#endif
CONF("music_player_interval") {
if (value) {
info.music_player_interval = strtod(value, 0);

View File

@ -56,9 +56,13 @@ namespace {
std::numeric_limits<int>::max(), 0, false);
conky::range_config_setting<int> default_graph_height("default_graph_height", 0,
std::numeric_limits<int>::max(), 25, false);
conky::range_config_setting<int> default_gauge_width("default_gauge_width", 0,
std::numeric_limits<int>::max(), 40, false);
conky::range_config_setting<int> default_gauge_height("default_gauge_height", 0,
std::numeric_limits<int>::max(), 25, false);
#endif /* BUILD_X11 */
}
int default_gauge_width = 40, default_gauge_height = 25;
/* special data types flags */
#define SF_SCALED (1 << 0)
@ -108,8 +112,8 @@ const char *scan_gauge(struct text_object *obj, const char *args, double scale)
memset(g, 0, sizeof(struct gauge));
/*width and height*/
g->width = default_gauge_width;
g->height = default_gauge_height;
g->width = default_gauge_width.get(*state);
g->height = default_gauge_height.get(*state);
if (scale)
g->scale = scale;

View File

@ -80,11 +80,6 @@ struct special_t {
extern struct special_t *specials;
extern int special_count;
#ifdef BUILD_X11
extern int default_gauge_width;
extern int default_gauge_height;
#endif /* BUILD_X11 */
/* forward declare to avoid mutual inclusion between specials.h and text_object.h */
struct text_object;