aboutsummaryrefslogtreecommitdiff
path: root/notify.h
blob: 6c43e294e0f3e39d6bc1ba689a781f66d2e62f8b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#pragma once
#include <stdbool.h>
#include <unistd.h>

struct terminal;

enum notify_when {
    /* First, so that it can be left out of initializer and still be
       the default */
    NOTIFY_ALWAYS,

    NOTIFY_UNFOCUSED,
    NOTIFY_INVISIBLE
};

enum notify_urgency {
    /* First, so that it can be left out of initializer and still be
       the default */
    NOTIFY_URGENCY_NORMAL,

    NOTIFY_URGENCY_LOW,
    NOTIFY_URGENCY_CRITICAL,
};

struct notification {
    char *id;
    char *title;
    char *body;
    char *icon;
    char *xdg_token;
    enum notify_when when;
    enum notify_urgency urgency;
    bool focus;
    bool report;

    pid_t pid;
    int stdout_fd;
};

bool notify_notify(const struct terminal *term, struct notification *notif);
void notify_free(struct terminal *term, struct notification *notif);