From 07061a674b63fda49349b0dd0336edae88d7320a Mon Sep 17 00:00:00 2001 From: Dave Shoreman Date: Wed, 25 Feb 2026 00:22:47 +0000 Subject: [PATCH 1/2] Restore (middle) click functionality to indicator Replaces the "Activate" menu item with a secondary target that calls the `action`/`--command` when middle-mouse is clicked. --- src/appindicator.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/appindicator.c b/src/appindicator.c index e193513..5acd774 100644 --- a/src/appindicator.c +++ b/src/appindicator.c @@ -176,15 +176,13 @@ build_indicator_menu (void) indicator_menu = gtk_menu_new (); - /* Add activate action as first item if action is set */ + /* Register secondary (middle-click) action */ if (action && g_ascii_strcasecmp (action, "quit") != 0 && g_ascii_strcasecmp (action, "menu") != 0) { - item = gtk_menu_item_new_with_label (_("Activate")); + item = gtk_menu_item_new (); g_signal_connect (item, "activate", G_CALLBACK (activate_cb), NULL); gtk_menu_shell_append (GTK_MENU_SHELL (indicator_menu), item); - - item = gtk_separator_menu_item_new (); - gtk_menu_shell_append (GTK_MENU_SHELL (indicator_menu), item); + app_indicator_set_secondary_activate_target (app_indicator, item); } /* Add custom menu items */ @@ -412,4 +410,3 @@ yad_appindicator_run (void) return exit_code; } - From b504029a72cee21436704187e42fb95df16ae8ab Mon Sep 17 00:00:00 2001 From: Dave Shoreman Date: Wed, 25 Feb 2026 12:10:23 +0000 Subject: [PATCH 2/2] Actionless indicator should quit by default Restores middle-click-quit by default (unless `--no-middle` is set) and removes the automatic Quit menu item to restore original --notification behaviour and avoid existing menus getting duplicated Quit items. --- data/yad.1 | 10 ++++++++-- src/appindicator.c | 12 +++--------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/data/yad.1 b/data/yad.1 index f5f1981..395425b 100644 --- a/data/yad.1 +++ b/data/yad.1 @@ -223,7 +223,7 @@ in EWMH specification. The behavior of dialog with this option is HIGHLY DEPENDS This option is deprecated. Use \fB--window-type\fP instead. .TP .B \-\-window-type=\fITYPE\fP -Create a window with the specified window type. \fITYPE\fPCan be one of \fInormal\fP, \fIdialog\fP, \fIutility\fP, +Create a window with the specified window type. \fITYPE\fP can be one of \fInormal\fP, \fIdialog\fP, \fIutility\fP, \fIdock\fP, \fIdesktop\fP, \fItooltip\fP, \fInotification\fP or \fIsplash\fP. The behavior of each window type depends on your window manager. See EWMH specification for details. @@ -840,7 +840,7 @@ See \fBNOTEBOOK and PANED\fP section for more about notebook dialog. .SS Notification options .TP .B \-\-command=\fICMD\fP -Set the command running when clicked on the icon. Default action is \fIquit\fP if \fI\-\-listen\fP not specified. +The command to run when clicking the icon. Default action is \fIquit\fP if \fI\-\-listen\fP not specified. .TP .B \-\-listen Listen for commands on stdin. See \fBNOTIFICATION\fP section. @@ -867,6 +867,9 @@ See \fBNOTIFICATION\fP section for more about separators. .SS Appindicator options .TP +.B \-\-command=\fICMD\fP +The command to run when middle-clicking the icon. Default action is \fIquit\fP if \fI\-\-no-middle\fP not specified. +.TP .B \-\-listen Listen for commands on stdin. See \fBNOTIFICATION\fP section. .TP @@ -879,6 +882,9 @@ Set separator character for menu values. Default is \fI|\fP. .B \-\-item-separator=\fISTRING\fP Set separator character for menu items. Default is \fI!\fP. .TP +.B \-\-no-middle +Disable exit on middle click when there's no other action defined. +.TP .B \-\-hidden Doesn't show icon at startup. diff --git a/src/appindicator.c b/src/appindicator.c index 5acd774..1c36029 100644 --- a/src/appindicator.c +++ b/src/appindicator.c @@ -177,7 +177,7 @@ build_indicator_menu (void) indicator_menu = gtk_menu_new (); /* Register secondary (middle-click) action */ - if (action && g_ascii_strcasecmp (action, "quit") != 0 && g_ascii_strcasecmp (action, "menu") != 0) + if (action && g_ascii_strcasecmp (action, "menu") != 0) { item = gtk_menu_item_new (); g_signal_connect (item, "activate", G_CALLBACK (activate_cb), NULL); @@ -223,14 +223,6 @@ build_indicator_menu (void) gtk_menu_shell_append (GTK_MENU_SHELL (indicator_menu), item); } - /* Add quit item */ - item = gtk_separator_menu_item_new (); - gtk_menu_shell_append (GTK_MENU_SHELL (indicator_menu), item); - - item = gtk_menu_item_new_with_label (_("Quit")); - g_signal_connect (item, "activate", G_CALLBACK (popup_menu_item_activate_cb), "quit"); - gtk_menu_shell_append (GTK_MENU_SHELL (indicator_menu), item); - gtk_widget_show_all (indicator_menu); app_indicator_set_menu (app_indicator, GTK_MENU (indicator_menu)); } @@ -359,6 +351,8 @@ yad_appindicator_run (void) icon = g_strdup (options.data.dialog_image); if (options.common_data.command) action = g_strdup (options.common_data.command); + else if (options.notification_data.middle) + action = "quit"; if (options.notification_data.menu) parse_menu_str (options.notification_data.menu);