all repos — tint2 @ 87da8c76cc809a5e0e4b87b99c7d254facb2cc05

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

Taskbar: thumbnails (config, tint2conf and doc)
o9000 mrovi9000@gmail.com
commit

87da8c76cc809a5e0e4b87b99c7d254facb2cc05

parent

e5ecc0c15d4ec42787971ed0b0c28848ea183455

M doc/manual.htmldoc/manual.html

@@ -481,6 +481,8 @@ <li><p><code>task_icon = boolean (0 or 1)</code> : Whether to display the task icon. There is no explicit option to control the task icon size; it depends on the vertical padding set with <code>task_padding</code>.</p></li>

<li><p><code>task_text = boolean (0 or 1)</code> : Whether to display the task text.</p></li> <li><p><code>task_centered = boolean (0 or 1)</code> : Whether the task text is centered.</p></li> <li><p><code>task_tooltip = boolean (0 or 1)</code> : Whether to show tooltips for tasks.</p></li> +<li><p><code>task_thumbnail = boolean (0 or 1)</code> : Whether to show thumbnail tooltips for tasks.</p></li> +<li><p><code>task_thumbnail_size = width</code> : Thumbnail size.</p></li> <li><p><code>task_maximum_size = width height</code></p> <ul> <li><code>width</code> is used with horizontal panels to limit the size of the tasks. Use <code>width = 0</code> to get full taskbar width.</li>
M doc/tint2.1doc/tint2.1

@@ -508,6 +508,10 @@ \fB\fCtask_centered = boolean (0 or 1)\fR : Whether the task text is centered.

.IP \(bu 2 \fB\fCtask_tooltip = boolean (0 or 1)\fR : Whether to show tooltips for tasks. .IP \(bu 2 +\fB\fCtask_thumbnail = boolean (0 or 1)\fR : Whether to show thumbnail tooltips for tasks. +.IP \(bu 2 +\fB\fCtask_thumbnail_size = width\fR : Thumbnail size. +.IP \(bu 2 \fB\fCtask_maximum_size = width height\fR .RS .IP \(bu 2
M doc/tint2.mddoc/tint2.md

@@ -409,6 +409,10 @@ * `task_centered = boolean (0 or 1)` : Whether the task text is centered.

* `task_tooltip = boolean (0 or 1)` : Whether to show tooltips for tasks. + * `task_thumbnail = boolean (0 or 1)` : Whether to show thumbnail tooltips for tasks. + + * `task_thumbnail_size = width` : Thumbnail size. + * `task_maximum_size = width height` * `width` is used with horizontal panels to limit the size of the tasks. Use `width = 0` to get full taskbar width. * `height` is used with vertical panels.
M src/config.csrc/config.c

@@ -1091,6 +1091,10 @@ }

// "tooltip" is deprecated but here for backwards compatibility else if (strcmp(key, "task_tooltip") == 0 || strcmp(key, "tooltip") == 0) panel_config.g_task.tooltip_enabled = atoi(value); + else if (strcmp(key, "task_thumbnail") == 0) + panel_config.g_task.thumbnail_enabled = atoi(value); + else if (strcmp(key, "task_thumbnail_size") == 0) + panel_config.g_task.thumbnail_width = MAX(8, atoi(value)); /* Systray */ else if (strcmp(key, "systray_padding") == 0) {
M src/taskbar/task.csrc/taskbar/task.c

@@ -50,6 +50,8 @@ }

cairo_surface_t *task_get_thumbnail(void *obj) { + if (!panel_config.g_task.thumbnail_enabled) + return NULL; Task *t = (Task *)obj; if (!t->thumbnail) task_refresh_thumbnail(t);

@@ -620,12 +622,14 @@ }

void task_refresh_thumbnail(Task *task) { + if (!panel_config.g_task.thumbnail_enabled) + return; if (task->current_state == TASK_ICONIFIED) return; double now = get_time(); if (now - task->thumbnail_last_update < 0.1) return; - cairo_surface_t *thumbnail = get_window_thumbnail(task->win); + cairo_surface_t *thumbnail = get_window_thumbnail(task->win, panel_config.g_task.thumbnail_width); if (!thumbnail) return; if (task->thumbnail)
M src/taskbar/task.hsrc/taskbar/task.h

@@ -46,6 +46,8 @@ PangoFontDescription *font_desc;

Color font[TASK_STATE_COUNT]; int config_font_mask; gboolean tooltip_enabled; + gboolean thumbnail_enabled; + int thumbnail_width; } GlobalTask; // Stores information about a task.
M src/taskbar/taskbar.csrc/taskbar/taskbar.c

@@ -46,7 +46,7 @@ gboolean hide_taskbar_if_empty;

gboolean always_show_all_desktop_tasks; TaskbarSortMethod taskbar_sort_method; Alignment taskbar_alignment; -static timeout *thumbnail_update_timer = NULL; +static timeout *thumbnail_update_timer; static GList *taskbar_task_orderings = NULL;

@@ -85,6 +85,7 @@ hide_inactive_tasks = FALSE;

hide_task_diff_monitor = FALSE; hide_taskbar_if_empty = FALSE; always_show_all_desktop_tasks = FALSE; + thumbnail_update_timer = NULL; taskbar_sort_method = TASKBAR_NOSORT; taskbar_alignment = ALIGN_LEFT; default_taskbarname();

@@ -362,6 +363,8 @@ }

void taskbar_start_thumbnail_timer() { + if (!panel_config.g_task.thumbnail_enabled) + return; change_timeout(&thumbnail_update_timer, 100, 10 * 1000, taskbar_update_thumbnails, NULL); }

@@ -792,6 +795,8 @@ }

void taskbar_update_thumbnails(void *arg) { + if (!panel_config.g_task.thumbnail_enabled) + return; for (int i = 0; i < num_panels; i++) { Panel *panel = &panels[i]; for (int j = 0; j < panel->num_desktops; j++) {
M src/tint2conf/properties.csrc/tint2conf/properties.c

@@ -97,7 +97,7 @@ GtkWidget *systray_background, *systray_monitor, *systray_name_filter;

// tooltip GtkWidget *tooltip_padding_x, *tooltip_padding_y, *tooltip_font, *tooltip_font_set, *tooltip_font_color; -GtkWidget *tooltip_task_show, *tooltip_show_after, *tooltip_hide_after; +GtkWidget *tooltip_task_show, *tooltip_show_after, *tooltip_hide_after, *tooltip_task_thumbnail, *tooltip_task_thumbnail_size; GtkWidget *clock_format_tooltip, *clock_tmz_tooltip; GtkWidget *tooltip_background;

@@ -3287,6 +3287,36 @@ tooltip_task_show,

_("If enabled, a tooltip showing the window title is displayed when the mouse cursor moves " "over task buttons."), NULL); + + row++, col = 2; + label = gtk_label_new(_("Thumbnails")); + gtk_misc_set_alignment(GTK_MISC(label), 0, 0); + gtk_widget_show(label); + gtk_table_attach(GTK_TABLE(table), label, col, col + 1, row, row + 1, GTK_FILL, 0, 0, 0); + col++; + + tooltip_task_thumbnail = gtk_check_button_new(); + gtk_widget_show(tooltip_task_thumbnail); + gtk_table_attach(GTK_TABLE(table), tooltip_task_thumbnail, col, col + 1, row, row + 1, GTK_FILL, 0, 0, 0); + col++; + gtk_tooltips_set_tip(tooltips, + tooltip_task_thumbnail, + _("If enabled, a tooltip showing the window thumbnail is displayed when the mouse cursor moves " + "over task buttons."), + NULL); + + row++, col = 2; + label = gtk_label_new(_("Thumbnail size")); + gtk_misc_set_alignment(GTK_MISC(label), 0, 0); + gtk_widget_show(label); + gtk_table_attach(GTK_TABLE(table), label, col, col + 1, row, row + 1, GTK_FILL, 0, 0, 0); + col++; + + tooltip_task_thumbnail_size = gtk_spin_button_new_with_range(8, 9000, 1); + gtk_spin_button_set_value(GTK_SPIN_BUTTON(tooltip_task_thumbnail_size), 210); + gtk_widget_show(tooltip_task_thumbnail_size); + gtk_table_attach(GTK_TABLE(table), tooltip_task_thumbnail_size, col, col + 1, row, row + 1, GTK_FILL, 0, 0, 0); + col++; row++, col = 2; label = gtk_label_new(_("Maximum width"));
M src/tint2conf/properties.hsrc/tint2conf/properties.h

@@ -105,7 +105,7 @@ extern GtkWidget *systray_background, *systray_monitor, *systray_name_filter;

// tooltip extern GtkWidget *tooltip_padding_x, *tooltip_padding_y, *tooltip_font, *tooltip_font_set, *tooltip_font_color; -extern GtkWidget *tooltip_task_show, *tooltip_show_after, *tooltip_hide_after; +extern GtkWidget *tooltip_task_show, *tooltip_show_after, *tooltip_hide_after, *tooltip_task_thumbnail, *tooltip_task_thumbnail_size; extern GtkWidget *clock_format_tooltip, *clock_tmz_tooltip; extern GtkWidget *tooltip_background;
M src/tint2conf/properties_rw.csrc/tint2conf/properties_rw.c

@@ -517,6 +517,11 @@ (int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(task_spacing)));

if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(task_font_set))) fprintf(fp, "task_font = %s\n", gtk_font_button_get_font_name(GTK_FONT_BUTTON(task_font))); fprintf(fp, "task_tooltip = %d\n", gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(tooltip_task_show)) ? 1 : 0); + fprintf(fp, "task_thumbnail = %d\n", gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(tooltip_task_thumbnail)) ? 1 : 0); + fprintf(fp, + "task_thumbnail_size = %d\n", + (int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(tooltip_task_thumbnail_size))); + // same for: "" _normal _active _urgent _iconified if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(task_default_color_set))) {

@@ -1732,6 +1737,10 @@ // "tooltip" is deprecated but here for backwards compatibility

else if (strcmp(key, "task_tooltip") == 0 || strcmp(key, "tooltip") == 0) { gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(tooltip_task_show), atoi(value)); } + else if (strcmp(key, "task_thumbnail") == 0) + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(tooltip_task_thumbnail), atoi(value)); + else if (strcmp(key, "task_thumbnail_size") == 0) + gtk_spin_button_set_value(GTK_SPIN_BUTTON(tooltip_task_thumbnail_size), MAX(8, atoi(value1))); /* Systray */ else if (strcmp(key, "systray") == 0) {
M src/util/window.csrc/util/window.c

@@ -357,7 +357,7 @@ XFree(text_property.value);

return result; } -cairo_surface_t *get_window_thumbnail(Window win) +cairo_surface_t *get_window_thumbnail(Window win, int size) { XWindowAttributes wa; if (!XGetWindowAttributes(server.display, win, &wa))

@@ -369,7 +369,7 @@

int tw, th; double sx, sy; double ox, oy; - tw = 210; + tw = size; th = h * tw / w; if (th > tw * 0.618) { th = (int)(tw * 0.618);
M src/util/window.hsrc/util/window.h

@@ -34,6 +34,6 @@ int get_icon_count(gulong *data, int num);

gulong *get_best_icon(gulong *data, int icon_count, int num, int *iw, int *ih, int best_icon_size); char *get_window_name(Window win); -cairo_surface_t *get_window_thumbnail(Window win); +cairo_surface_t *get_window_thumbnail(Window win, int size); #endif
M themes/tint2rcthemes/tint2rc

@@ -1,4 +1,4 @@

-#---- Generated by tint2conf d8b1 ---- +#---- Generated by tint2conf aeaf ---- # See https://gitlab.com/o9000/tint2/wikis/Configure for # full documentation of the configuration options. #-------------------------------------

@@ -115,6 +115,8 @@ urgent_nb_of_blink = 100000

task_maximum_size = 150 35 task_padding = 2 2 4 task_tooltip = 1 +task_thumbnail = 0 +task_thumbnail_size = 210 task_font_color = #ffffff 100 task_background_id = 2 task_active_background_id = 3