all repos — tint2 @ e345c0ddcde8923b238189a0debd8cf59e954149

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

tint2conf: Add more mouse events for clock and battery (issue #505)
o9000 o9000
commit

e345c0ddcde8923b238189a0debd8cf59e954149

parent

c874e763435aa8616bf7ac29214ad32c378a5d74

4 files changed, 172 insertions(+), 2 deletions(-)

jump to
M AUTHORSAUTHORS

@@ -22,5 +22,5 @@ Rene Garcia <garciamx@gmail.com> : launcher SVG support

Marcelo Vianna : taskbar sorting Xico Atelo : startup notifications Craig Oakes : WM flags, issue tracker organization - + Jeff Blake (https://gitlab.com/u/berkley4) : more mouse event handlers
M src/tint2conf/properties.csrc/tint2conf/properties.c

@@ -84,6 +84,7 @@

// clock GtkWidget *clock_format_line1, *clock_format_line2, *clock_tmz_line1, *clock_tmz_line2; GtkWidget *clock_left_command, *clock_right_command; +GtkWidget *clock_mclick_command, *clock_rclick_command, *clock_uwheel_command, *clock_dwheel_command; GtkWidget *clock_padding_x, *clock_padding_y, *clock_font_line1, *clock_font_line2, *clock_font_color; GtkWidget *clock_background;

@@ -91,6 +92,7 @@ // battery

GtkWidget *battery_hide_if_higher, *battery_alert_if_lower, *battery_alert_cmd; GtkWidget *battery_padding_x, *battery_padding_y, *battery_font_line1, *battery_font_line2, *battery_font_color; GtkWidget *battery_background; +GtkWidget *battery_left_command, *battery_mclick_command, *battery_right_command, *battery_uwheel_command, *battery_dwheel_command; // systray GtkWidget *systray_icon_order, *systray_padding_x, *systray_padding_y, *systray_spacing;

@@ -3316,7 +3318,7 @@ gtk_label_set_use_markup(GTK_LABEL(label), TRUE);

gtk_widget_show(label); gtk_box_pack_start(GTK_BOX(parent), label, FALSE, FALSE, 0); - table = gtk_table_new(2, 10, FALSE); + table = gtk_table_new(5, 10, FALSE); gtk_widget_show(table); gtk_box_pack_start(GTK_BOX(parent), table, FALSE, FALSE, 0); gtk_table_set_row_spacings(GTK_TABLE(table), ROW_SPACING);

@@ -3351,6 +3353,51 @@ gtk_table_attach(GTK_TABLE(table), clock_right_command, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);

col++; gtk_tooltips_set_tip(tooltips, clock_right_command, _("Specifies a command that will be executed when the clock receives a right click."), NULL); + + row++, col = 2; + label = gtk_label_new(_("Middle click command")); + 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++; + + clock_mclick_command = gtk_entry_new(); + gtk_widget_show(clock_mclick_command); + gtk_entry_set_width_chars(GTK_ENTRY(clock_mclick_command), 50); + gtk_table_attach(GTK_TABLE(table), clock_mclick_command, col, col+1, row, row+1, GTK_FILL, 0, 0, 0); + col++; + gtk_tooltips_set_tip(tooltips, clock_mclick_command, + _("Specifies a command that will be executed when the clock receives a middle click."), NULL); + + row++, col = 2; + label = gtk_label_new(_("Wheel scroll up command")); + 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++; + + clock_uwheel_command = gtk_entry_new(); + gtk_widget_show(clock_uwheel_command); + gtk_entry_set_width_chars(GTK_ENTRY(clock_uwheel_command), 50); + gtk_table_attach(GTK_TABLE(table), clock_uwheel_command, col, col+1, row, row+1, GTK_FILL, 0, 0, 0); + col++; + gtk_tooltips_set_tip(tooltips, clock_uwheel_command, + _("Specifies a command that will be executed when the clock receives a mouse scroll up."), NULL); + + row++, col = 2; + label = gtk_label_new(_("Wheel scroll down command")); + 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++; + + clock_dwheel_command = gtk_entry_new(); + gtk_widget_show(clock_dwheel_command); + gtk_entry_set_width_chars(GTK_ENTRY(clock_dwheel_command), 50); + gtk_table_attach(GTK_TABLE(table), clock_dwheel_command, col, col+1, row, row+1, GTK_FILL, 0, 0, 0); + col++; + gtk_tooltips_set_tip(tooltips, clock_dwheel_command, + _("Specifies a command that will be executed when the clock receives a mouse scroll down."), NULL); change_paragraph(parent);

@@ -3766,6 +3813,95 @@ gtk_entry_set_width_chars(GTK_ENTRY(battery_alert_cmd), 50);

gtk_table_attach(GTK_TABLE(table), battery_alert_cmd, col, col+3, row, row+1, GTK_FILL, 0, 0, 0); col++; gtk_tooltips_set_tip(tooltips, battery_alert_cmd, _("Command to be executed when the alert threshold is reached."), NULL); + + change_paragraph(parent); + + label = gtk_label_new(_("<b>Mouse events</b>")); + gtk_misc_set_alignment(GTK_MISC(label), 0, 0); + gtk_label_set_use_markup(GTK_LABEL(label), TRUE); + gtk_widget_show(label); + gtk_box_pack_start(GTK_BOX(parent), label, FALSE, FALSE, 0); + + table = gtk_table_new(5, 10, FALSE); + gtk_widget_show(table); + gtk_box_pack_start(GTK_BOX(parent), table, FALSE, FALSE, 0); + gtk_table_set_row_spacings(GTK_TABLE(table), ROW_SPACING); + gtk_table_set_col_spacings(GTK_TABLE(table), COL_SPACING); + row = 0, col = 2; + + label = gtk_label_new(_("Left click command")); + 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++; + + battery_left_command = gtk_entry_new(); + gtk_widget_show(battery_left_command); + gtk_entry_set_width_chars(GTK_ENTRY(battery_left_command), 50); + gtk_table_attach(GTK_TABLE(table), battery_left_command, col, col+1, row, row+1, GTK_FILL, 0, 0, 0); + col++; + gtk_tooltips_set_tip(tooltips, battery_left_command, + _("Specifies a command that will be executed when the battery receives a left click."), NULL); + + row++, col = 2; + label = gtk_label_new(_("Right click command")); + 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++; + + battery_right_command = gtk_entry_new(); + gtk_widget_show(battery_right_command); + gtk_entry_set_width_chars(GTK_ENTRY(battery_right_command), 50); + gtk_table_attach(GTK_TABLE(table), battery_right_command, col, col+1, row, row+1, GTK_FILL, 0, 0, 0); + col++; + gtk_tooltips_set_tip(tooltips, battery_right_command, + _("Specifies a command that will be executed when the battery receives a right click."), NULL); + + row++, col = 2; + label = gtk_label_new(_("Middle click command")); + 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++; + + battery_mclick_command = gtk_entry_new(); + gtk_widget_show(battery_mclick_command); + gtk_entry_set_width_chars(GTK_ENTRY(battery_mclick_command), 50); + gtk_table_attach(GTK_TABLE(table), battery_mclick_command, col, col+1, row, row+1, GTK_FILL, 0, 0, 0); + col++; + gtk_tooltips_set_tip(tooltips, battery_mclick_command, + _("Specifies a command that will be executed when the battery receives a middle click."), NULL); + + row++, col = 2; + label = gtk_label_new(_("Wheel scroll up command")); + 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++; + + battery_uwheel_command = gtk_entry_new(); + gtk_widget_show(battery_uwheel_command); + gtk_entry_set_width_chars(GTK_ENTRY(battery_uwheel_command), 50); + gtk_table_attach(GTK_TABLE(table), battery_uwheel_command, col, col+1, row, row+1, GTK_FILL, 0, 0, 0); + col++; + gtk_tooltips_set_tip(tooltips, battery_uwheel_command, + _("Specifies a command that will be executed when the battery receives a mouse scroll up."), NULL); + + row++, col = 2; + label = gtk_label_new(_("Wheel scroll down command")); + 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++; + + battery_dwheel_command = gtk_entry_new(); + gtk_widget_show(battery_dwheel_command); + gtk_entry_set_width_chars(GTK_ENTRY(battery_dwheel_command), 50); + gtk_table_attach(GTK_TABLE(table), battery_dwheel_command, col, col+1, row, row+1, GTK_FILL, 0, 0, 0); + col++; + gtk_tooltips_set_tip(tooltips, battery_dwheel_command, + _("Specifies a command that will be executed when the battery receives a mouse scroll down."), NULL); change_paragraph(parent);
M src/tint2conf/properties.hsrc/tint2conf/properties.h

@@ -87,6 +87,7 @@

// clock extern GtkWidget *clock_format_line1, *clock_format_line2, *clock_tmz_line1, *clock_tmz_line2; extern GtkWidget *clock_left_command, *clock_right_command; +extern GtkWidget *clock_mclick_command, *clock_rclick_command, *clock_uwheel_command, *clock_dwheel_command; extern GtkWidget *clock_padding_x, *clock_padding_y, *clock_font_line1, *clock_font_line2, *clock_font_color; extern GtkWidget *clock_background;

@@ -94,6 +95,7 @@ // battery

extern GtkWidget *battery_hide_if_higher, *battery_alert_if_lower, *battery_alert_cmd; extern GtkWidget *battery_padding_x, *battery_padding_y, *battery_font_line1, *battery_font_line2, *battery_font_color; extern GtkWidget *battery_background; +extern GtkWidget *battery_left_command, *battery_mclick_command, *battery_right_command, *battery_uwheel_command, *battery_dwheel_command; // systray extern GtkWidget *systray_icon_order, *systray_padding_x, *systray_padding_y, *systray_spacing;
M src/tint2conf/properties_rw.csrc/tint2conf/properties_rw.c

@@ -548,6 +548,9 @@ fprintf(fp, "clock_tooltip = %s\n", gtk_entry_get_text(GTK_ENTRY(clock_format_tooltip)));

fprintf(fp, "clock_tooltip_timezone = %s\n", gtk_entry_get_text(GTK_ENTRY(clock_tmz_tooltip))); fprintf(fp, "clock_lclick_command = %s\n", gtk_entry_get_text(GTK_ENTRY(clock_left_command))); fprintf(fp, "clock_rclick_command = %s\n", gtk_entry_get_text(GTK_ENTRY(clock_right_command))); + fprintf(fp, "clock_mclick_command = %s\n", gtk_entry_get_text(GTK_ENTRY(clock_mclick_command))); + fprintf(fp, "clock_uwheel_command = %s\n", gtk_entry_get_text(GTK_ENTRY(clock_uwheel_command))); + fprintf(fp, "clock_dwheel_command = %s\n", gtk_entry_get_text(GTK_ENTRY(clock_dwheel_command))); fprintf(fp, "\n"); }

@@ -573,6 +576,11 @@ (int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(battery_padding_x)),

(int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(battery_padding_y))); fprintf(fp, "battery_background_id = %d\n", gtk_combo_box_get_active(GTK_COMBO_BOX(battery_background))); fprintf(fp, "battery_hide = %d\n", (int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(battery_hide_if_higher))); + fprintf(fp, "battery_lclick_command = %s\n", gtk_entry_get_text(GTK_ENTRY(battery_left_command))); + fprintf(fp, "battery_rclick_command = %s\n", gtk_entry_get_text(GTK_ENTRY(battery_right_command))); + fprintf(fp, "battery_mclick_command = %s\n", gtk_entry_get_text(GTK_ENTRY(battery_mclick_command))); + fprintf(fp, "battery_uwheel_command = %s\n", gtk_entry_get_text(GTK_ENTRY(battery_uwheel_command))); + fprintf(fp, "battery_dwheel_command = %s\n", gtk_entry_get_text(GTK_ENTRY(battery_dwheel_command))); fprintf(fp, "\n"); }

@@ -935,6 +943,21 @@ gtk_spin_button_set_value(GTK_SPIN_BUTTON(battery_hide_if_higher), 101.0);

else gtk_spin_button_set_value(GTK_SPIN_BUTTON(battery_hide_if_higher), atoi(value)); } + else if (strcmp(key, "battery_lclick_command") == 0) { + gtk_entry_set_text(GTK_ENTRY(battery_left_command), value); + } + else if (strcmp(key, "battery_rclick_command") == 0) { + gtk_entry_set_text(GTK_ENTRY(battery_right_command), value); + } + else if (strcmp(key, "battery_mclick_command") == 0) { + gtk_entry_set_text(GTK_ENTRY(battery_mclick_command), value); + } + else if (strcmp(key, "battery_uwheel_command") == 0) { + gtk_entry_set_text(GTK_ENTRY(battery_uwheel_command), value); + } + else if (strcmp(key, "battery_dwheel_command") == 0) { + gtk_entry_set_text(GTK_ENTRY(battery_dwheel_command), value); + } /* Clock */ else if (strcmp(key, "time1_format") == 0) {

@@ -986,6 +1009,15 @@ gtk_entry_set_text(GTK_ENTRY(clock_left_command), value);

} else if (strcmp(key, "clock_rclick_command") == 0) { gtk_entry_set_text(GTK_ENTRY(clock_right_command), value); + } + else if (strcmp(key, "clock_mclick_command") == 0) { + gtk_entry_set_text(GTK_ENTRY(clock_mclick_command), value); + } + else if (strcmp(key, "clock_uwheel_command") == 0) { + gtk_entry_set_text(GTK_ENTRY(clock_uwheel_command), value); + } + else if (strcmp(key, "clock_dwheel_command") == 0) { + gtk_entry_set_text(GTK_ENTRY(clock_dwheel_command), value); } /* Taskbar */