Add notification-specific context menu

This commit is contained in:
Lukas Radermacher 2021-04-05 16:06:15 +02:00
parent bec5e9d25a
commit 6c61f3e5e2
2 changed files with 16 additions and 2 deletions

View File

@ -312,13 +312,19 @@ static GList *get_actionable_notifications(void)
/* see menu.h */ /* see menu.h */
void context_menu(void) void context_menu(void)
{
GList *notifications = get_actionable_notifications();
context_menu_for(notifications);
}
/* see menu.h */
void context_menu_for(GList *notifications)
{ {
if (menu_ctx.locked_notifications) { if (menu_ctx.locked_notifications) {
LOG_W("Context menu already running, refusing to rerun"); LOG_W("Context menu already running, refusing to rerun");
return; return;
} }
GList *notifications = get_actionable_notifications();
menu_ctx.locked_notifications = notifications; menu_ctx.locked_notifications = notifications;
GError *err = NULL; GError *err = NULL;

View File

@ -2,6 +2,8 @@
#ifndef DUNST_MENU_H #ifndef DUNST_MENU_H
#define DUNST_MENU_H #define DUNST_MENU_H
#include <glib.h>
/** /**
* Extract all urls from the given string. * Extract all urls from the given string.
* *
@ -16,9 +18,15 @@ void invoke_action(const char *action);
void regex_teardown(void); void regex_teardown(void);
/** /**
* Open the context menu that lets the user select urls/actions/etc. * Open the context menu that lets the user select urls/actions/etc for all displayed notifications.
*/ */
void context_menu(void); void context_menu(void);
/**
* Open the context menu that lets the user select urls/actions/etc for the specified notifications.
* @param notifications (nullable) List of notifications for which the context menu should be opened
*/
void context_menu_for(GList *notifications);
#endif #endif
/* vim: set ft=c tabstop=8 shiftwidth=8 expandtab textwidth=0: */ /* vim: set ft=c tabstop=8 shiftwidth=8 expandtab textwidth=0: */