Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions data/yad.1
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down Expand Up @@ -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.
Expand All @@ -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
Expand All @@ -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.

Expand Down
21 changes: 6 additions & 15 deletions src/appindicator.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down Expand Up @@ -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));
}
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -412,4 +404,3 @@ yad_appindicator_run (void)

return exit_code;
}