Hide executor if output is empty (issue #648)
o9000 mrovi9000@gmail.com
3 files changed,
32 insertions(+),
17 deletions(-)
M
src/execplugin/execplugin.c
→
src/execplugin/execplugin.c
@@ -188,6 +188,8 @@ instantiate_area_gradients(&execp->area);
if (!execp->backend->timer) execp->backend->timer = add_timeout(10, 0, execp_timer_callback, execp, &execp->backend->timer); + + execp_update_post_read(execp); } }@@ -319,21 +321,6 @@ *icon_w = *icon_h = 0;
} } else { *icon_w = *icon_h = 0; - } - - if ((*icon_h == 0 || *icon_w == 0) && execp->backend->text[0] == 0) { - *new_size = 0; - *txt_height_ink = 0; - *txt_height = 0; - *txt_width = 0; - if (panel_horizontal) { - if (area->width) - *resized = TRUE; - } else { - if (area->height) - *resized = TRUE; - } - return; } *text_next_line = !panel_horizontal && *icon_w > area->width / 2;@@ -850,3 +837,29 @@ }
} return strdup(execp->backend->tooltip_text); } + +void execp_update_post_read(Execp *execp) +{ + int icon_h, icon_w; + if (reload_icon(execp)) { + if (execp->backend->icon) { + imlib_context_set_image(execp->backend->icon); + icon_w = imlib_image_get_width(); + icon_h = imlib_image_get_height(); + } else { + icon_w = icon_h = 0; + } + } else { + icon_w = icon_h = 0; + } + + if ((icon_h == 0 || icon_w == 0) && execp->backend->text[0] == 0) { + if (execp->area.on_screen) + hide(&execp->area); + } else { + if (!execp->area.on_screen) + show(&execp->area); + execp->area.resize_needed = TRUE; + schedule_panel_redraw(); + } +}
M
src/execplugin/execplugin.h
→
src/execplugin/execplugin.h
@@ -138,6 +138,9 @@ // No command might be running.
// Returns 1 if the output has been updated and a redraw is needed. gboolean read_execp(void *obj); +// Called for Execp front elements when the command output has changed. +void execp_update_post_read(Execp *execp); + void execp_default_font_changed(); #endif // EXECPLUGIN_H
M
src/tint.c
→
src/tint.c
@@ -1865,8 +1865,7 @@ if (read_execp(execp)) {
GList *l_instance; for (l_instance = execp->backend->instances; l_instance; l_instance = l_instance->next) { Execp *instance = l_instance->data; - instance->area.resize_needed = TRUE; - schedule_panel_redraw(); + execp_update_post_read(instance); } } }