From f6de7a8c77d123159aaa73c1369be3b0be5818a1 Mon Sep 17 00:00:00 2001 From: Andre Miranda Date: Fri, 8 Nov 2019 19:33:32 -0300 Subject: [PATCH] panel-plugin: Toggle do not disturb with middle mouse click --- panel-plugin/notification-plugin.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/panel-plugin/notification-plugin.c b/panel-plugin/notification-plugin.c index 0572de2..b43a33b 100644 --- a/panel-plugin/notification-plugin.c +++ b/panel-plugin/notification-plugin.c @@ -88,12 +88,20 @@ cb_button_pressed (GtkButton *button, GdkEventButton *event, NotificationPlugin *notification_plugin) { - if (event->button != 1) - return FALSE; - if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button))) - notification_plugin_popup_menu (notification_plugin); - - return TRUE; + if (event->button == 1 && !gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button))) + { + notification_plugin_popup_menu (notification_plugin); + return TRUE; + } + + if (event->button == 2) + { + gboolean state = xfconf_channel_get_bool (notification_plugin->channel, "/do-not-disturb", FALSE); + xfconf_channel_set_bool (notification_plugin->channel, "/do-not-disturb", !state); + return TRUE; + } + + return FALSE; } -- 2.23.0