Dunst
Lightweight notification daemon
Loading...
Searching...
No Matches
menu.c File Reference
#include "menu.h"
#include <errno.h>
#include <glib.h>
#include <regex.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/wait.h>
#include <unistd.h>
#include "dbus.h"
#include "dunst.h"
#include "log.h"
#include "notification.h"
#include "queues.h"
#include "settings.h"
#include "utils.h"
+ Include dependency graph for menu.c:

Go to the source code of this file.

Functions

static gpointer context_menu_thread (gpointer data)
 
static bool regex_init (void)
 Initializes regexes needed for matching.
 
void regex_teardown (void)
 
char * extract_urls (const char *to_match)
 Extract all urls from the given string.
 
void open_browser (const char *in)
 
char * notification_dmenu_string (struct notification *n)
 
void invoke_action (const char *action)
 
void dispatch_menu_result (const char *input)
 Dispatch whatever has been returned by dmenu.
 
char * invoke_dmenu (const char *dmenu_input)
 Call dmenu with the specified input.
 
static GList * get_actionable_notifications (void)
 Lock and get all notifications with an action or URL.
 
void context_menu (void)
 Open the context menu that lets the user select urls/actions/etc for all displayed notifications.
 
void context_menu_for (GList *notifications)
 Open the context menu that lets the user select urls/actions/etc for the specified notifications.
 
static gboolean context_menu_result_dispatch (gpointer user_data)
 

Variables

static bool is_initialized = false
 
static regex_t url_regex
 
struct { 
 
   GList *   locked_notifications 
 
menu_ctx 
 

Detailed Description

License
BSD-3-Clause

Definition in file menu.c.

Function Documentation

◆ context_menu()

void context_menu ( void )

Open the context menu that lets the user select urls/actions/etc for all displayed notifications.

Definition at line 320 of file menu.c.

◆ context_menu_for()

void context_menu_for ( GList * notifications)

Open the context menu that lets the user select urls/actions/etc for the specified notifications.

Parameters
notifications(nullable) List of notifications for which the context menu should be opened

Definition at line 326 of file menu.c.

◆ context_menu_result_dispatch()

static gboolean context_menu_result_dispatch ( gpointer user_data)
static

Definition at line 347 of file menu.c.

◆ context_menu_thread()

static gpointer context_menu_thread ( gpointer data)
static

Definition at line 382 of file menu.c.

◆ dispatch_menu_result()

void dispatch_menu_result ( const char * input)

Dispatch whatever has been returned by dmenu.

If the given result of dmenu is empty or NULL, nothing will be done.

Parameters
inputThe result from dmenu.

Definition at line 228 of file menu.c.

◆ extract_urls()

char * extract_urls ( const char * to_match)

Extract all urls from the given string.

Parameters
to_match(nullable) String to extract URLs
Returns
a string of urls separated by '
'
Return values
NULLNo URLs found

Definition at line 72 of file menu.c.

◆ get_actionable_notifications()

static GList * get_actionable_notifications ( void )
static

Lock and get all notifications with an action or URL.

Definition at line 303 of file menu.c.

◆ invoke_action()

void invoke_action ( const char * action)

Definition at line 174 of file menu.c.

◆ invoke_dmenu()

char * invoke_dmenu ( const char * dmenu_input)

Call dmenu with the specified input.

Blocks until dmenu is finished.

Parameters
dmenu_inputThe input string to feed into dmenu
Returns
the selected string from dmenu

Definition at line 249 of file menu.c.

◆ notification_dmenu_string()

char * notification_dmenu_string ( struct notification * n)

Definition at line 149 of file menu.c.

◆ open_browser()

void open_browser ( const char * in)

Definition at line 106 of file menu.c.

◆ regex_init()

static bool regex_init ( void )
static

Initializes regexes needed for matching.

Returns
true if initialization succeeded

Definition at line 43 of file menu.c.

◆ regex_teardown()

void regex_teardown ( void )

Definition at line 64 of file menu.c.

Variable Documentation

◆ is_initialized

bool is_initialized = false
static

Definition at line 29 of file menu.c.

◆ locked_notifications

GList* locked_notifications

Definition at line 35 of file menu.c.

◆ url_regex

regex_t url_regex
static

Definition at line 30 of file menu.c.