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 e193513..1c36029 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 */ - if (action && g_ascii_strcasecmp (action, "quit") != 0 && g_ascii_strcasecmp (action, "menu") != 0) + /* Register secondary (middle-click) action */ + if (action && 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 */ @@ -225,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)); } @@ -361,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); @@ -412,4 +404,3 @@ yad_appindicator_run (void) return exit_code; } -