all repos — tint2 @ 0f00212c58630c104a14650e94b654324c21ecbb

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

add execp_monitor config #799
Chris Lee @klee93
commit

0f00212c58630c104a14650e94b654324c21ecbb

parent

dba0e66646d7d7fb12bbf7874b6aa9c1c1ef4b19

M doc/tint2.mddoc/tint2.md

@@ -621,6 +621,8 @@ * `execp_centered = boolean (0 or 1)` : Whether to center the text. *(since 0.12.4)*

* `execp_padding = horizontal_padding vertical_padding spacing_between_icon_and_text` *(since 0.12.4)* + * `execp_monitor = integer (1, 2, ...), primary or all` : On which monitor to draw the executor. The first monitor is `1`. *(since 17.0)* + * `execp_lclick_command = text` : Command to execute on left click. If not defined, `execp_command` is executed immediately, unless it is currently running. *(since 0.12.4)* * `execp_mclick_command = text` : Command to execute on right click. If not defined, `execp_command` is executed immediately, unless it is currently running. *(since 0.12.4)* * `execp_rclick_command = text` : Command to execute on middle click. If not defined, `execp_command` is executed immediately, unless it is currently running. *(since 0.12.4)*
M src/config.csrc/config.c

@@ -697,6 +697,9 @@ fprintf(stderr, "tint2: execp_interval must be an integer >= 0\n");

} else { execp->backend->interval = v; } + } else if (strcmp(key, "execp_monitor") == 0) { + Execp *execp = get_or_create_last_execp(); + execp->backend->monitor = config_get_monitor(value); } else if (strcmp(key, "execp_has_icon") == 0) { Execp *execp = get_or_create_last_execp(); execp->backend->has_icon = atoi(value);
M src/execplugin/execplugin.csrc/execplugin/execplugin.c

@@ -43,6 +43,7 @@ execp->backend->interval = 30;

execp->backend->cache_icon = TRUE; execp->backend->centered = TRUE; execp->backend->font_color.alpha = 0.5; + execp->backend->monitor = -1; INIT_TIMER(execp->backend->timer); return execp; }

@@ -50,6 +51,17 @@

gpointer create_execp_frontend(gconstpointer arg, gpointer data) { Execp *execp_backend = (Execp *)arg; + Panel *panel = data; + if (execp_backend->backend->monitor >= 0 && + panel->monitor != execp_backend->backend->monitor) { + printf("Skipping executor '%s' with monitor %d for panel on monitor %d\n", + execp_backend->backend->command, + execp_backend->backend->monitor, panel->monitor); + return NULL; + } + printf("Creating executor '%s' with monitor %d for panel on monitor %d\n", + execp_backend->backend->command, + execp_backend->backend->monitor, panel->monitor); Execp *execp_frontend = (Execp *)calloc(1, sizeof(Execp)); execp_frontend->backend = execp_backend->backend;

@@ -163,7 +175,8 @@ return;

// panel->execp_list is now a copy of the pointer panel_config.execp_list // We make it a deep copy - panel->execp_list = g_list_copy_deep(panel_config.execp_list, create_execp_frontend, NULL); + panel->execp_list = g_list_copy_deep(panel_config.execp_list, create_execp_frontend, panel); + panel->execp_list = g_list_remove_all(panel->execp_list, NULL); for (GList *l = panel->execp_list; l; l = l->next) { Execp *execp = l->data;
M src/execplugin/execplugin.hsrc/execplugin/execplugin.h

@@ -24,6 +24,7 @@ // Command to execute at a specified interval

char *command; // Interval in seconds int interval; + int monitor; // 1 if first line of output is an icon path gboolean has_icon; gboolean cache_icon;
M src/tint2conf/properties.csrc/tint2conf/properties.c

@@ -4374,6 +4374,31 @@ "which allows rich text formatting. Note that using this with commands "

"that print data downloaded from the Internet is a potential security risk."), NULL); + row++, col = 2; + label = gtk_label_new(_("Monitor")); + 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++; + + executor->execp_monitor = gtk_combo_box_text_new(); + gtk_widget_show(executor->execp_monitor); + gtk_table_attach(GTK_TABLE(table), executor->execp_monitor, col, col + 1, row, row + 1, GTK_FILL, 0, 0, 0); + col++; + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(executor->execp_monitor), _("All")); + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(executor->execp_monitor), _("Primary")); + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(executor->execp_monitor), _("1")); + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(executor->execp_monitor), _("2")); + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(executor->execp_monitor), _("3")); + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(executor->execp_monitor), _("4")); + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(executor->execp_monitor), _("5")); + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(executor->execp_monitor), _("6")); + gtk_combo_box_set_active(GTK_COMBO_BOX(executor->execp_monitor), 0); + gtk_tooltips_set_tip(tooltips, + executor->execp_monitor, + _("Specifies the monitor on which to place the executor."), + NULL); + change_paragraph(parent); label = gtk_label_new(_("<b>Mouse events</b>"));
M src/tint2conf/properties.hsrc/tint2conf/properties.h

@@ -133,7 +133,7 @@ GtkWidget *container;

GtkWidget *page_execp; GtkWidget *page_label; GtkWidget *execp_command, *execp_interval, *execp_has_icon, *execp_cache_icon, *execp_show_tooltip; - GtkWidget *execp_continuous, *execp_markup, *execp_tooltip; + GtkWidget *execp_continuous, *execp_markup, *execp_tooltip, *execp_monitor; GtkWidget *execp_left_command, *execp_right_command; GtkWidget *execp_mclick_command, *execp_rclick_command, *execp_uwheel_command, *execp_dwheel_command; GtkWidget *execp_font, *execp_font_set, *execp_font_color, *execp_padding_x, *execp_padding_y, *execp_centered;
M src/tint2conf/properties_rw.csrc/tint2conf/properties_rw.c

@@ -871,6 +871,16 @@ (int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(executor->execp_continuous)));

fprintf(fp, "execp_markup = %d\n", gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(executor->execp_markup)) ? 1 : 0); + fprintf(fp, "execp_monitor = "); + if (gtk_combo_box_get_active(GTK_COMBO_BOX(executor->execp_monitor)) <= 0) { + fprintf(fp, "all"); + } else if (gtk_combo_box_get_active(GTK_COMBO_BOX(executor->execp_monitor)) == 1) { + fprintf(fp, "primary"); + } else { + fprintf(fp, "%d", MAX(1, gtk_combo_box_get_active(GTK_COMBO_BOX(executor->execp_monitor)) - 1)); + } + fprintf(fp, "\n"); + if (!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(executor->execp_show_tooltip))) { fprintf(fp, "execp_tooltip = \n"); } else {

@@ -1964,6 +1974,23 @@ } else if (strcmp(key, "execp_continuous") == 0) {

gtk_spin_button_set_value(GTK_SPIN_BUTTON(execp_get_last()->execp_continuous), atoi(value)); } else if (strcmp(key, "execp_markup") == 0) { gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(execp_get_last()->execp_markup), atoi(value)); + } else if (strcmp(key, "execp_monitor") == 0) { + if (strcmp(value, "all") == 0) + gtk_combo_box_set_active(GTK_COMBO_BOX(execp_get_last()->execp_monitor), 0); + else if (strcmp(value, "primary") == 0) + gtk_combo_box_set_active(GTK_COMBO_BOX(execp_get_last()->execp_monitor), 1); + else if (strcmp(value, "1") == 0) + gtk_combo_box_set_active(GTK_COMBO_BOX(execp_get_last()->execp_monitor), 2); + else if (strcmp(value, "2") == 0) + gtk_combo_box_set_active(GTK_COMBO_BOX(execp_get_last()->execp_monitor), 3); + else if (strcmp(value, "3") == 0) + gtk_combo_box_set_active(GTK_COMBO_BOX(execp_get_last()->execp_monitor), 4); + else if (strcmp(value, "4") == 0) + gtk_combo_box_set_active(GTK_COMBO_BOX(execp_get_last()->execp_monitor), 5); + else if (strcmp(value, "5") == 0) + gtk_combo_box_set_active(GTK_COMBO_BOX(execp_get_last()->execp_monitor), 6); + else if (strcmp(value, "6") == 0) + gtk_combo_box_set_active(GTK_COMBO_BOX(execp_get_last()->execp_monitor), 7); } else if (strcmp(key, "execp_tooltip") == 0) { if (strlen(value) > 0) { gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(execp_get_last()->execp_show_tooltip), 1);