all repos — tint2 @ 6f05c9d3273b1f2fddf52c56dd15c816dfa11fbb

fork of the tint2 desktop panel for my custom setup - only minimized windows across all desktops for the taskbar

Hide executor if output is empty (issue #648)
o9000 mrovi9000@gmail.com
commit

6f05c9d3273b1f2fddf52c56dd15c816dfa11fbb

parent

30429b88b3e24def1f495aaaacc066c420189c3c

3 files changed, 32 insertions(+), 17 deletions(-)

jump to
M src/execplugin/execplugin.csrc/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.hsrc/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.csrc/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); } } }