foot/notify.h

54 lines
1.1 KiB
C
Raw Normal View History

#pragma once
#include <stdbool.h>
2024-07-23 06:59:46 +02:00
#include <unistd.h>
struct terminal;
enum notify_when {
2024-07-23 06:59:46 +02:00
/* First, so that it can be left out of initializer and still be
the default */
NOTIFY_ALWAYS,
2024-07-23 06:59:46 +02:00
NOTIFY_UNFOCUSED,
NOTIFY_INVISIBLE
};
enum notify_urgency {
2024-07-23 06:59:46 +02:00
/* First, so that it can be left out of initializer and still be
the default */
NOTIFY_URGENCY_NORMAL,
2024-07-23 06:59:46 +02:00
NOTIFY_URGENCY_LOW,
NOTIFY_URGENCY_CRITICAL,
};
2024-07-23 06:59:46 +02:00
struct notification {
/*
* Set by caller of notify_notify()
*/
char *id;
char *title;
char *body;
2024-07-23 06:59:46 +02:00
char *icon;
enum notify_when when;
enum notify_urgency urgency;
bool focus;
bool report;
2024-07-23 06:59:46 +02:00
/*
* Used internally by notify
*/
char *xdg_token; /* XDG activation token, from daemon */
pid_t pid; /* Notifier command PID */
int stdout_fd; /* Notifier command's stdout */
char *stdout; /* Data we've reado from command's stdout */
size_t stdout_sz;
};
2024-07-23 06:59:46 +02:00
bool notify_notify(const struct terminal *term, struct notification *notif);
void notify_free(struct terminal *term, struct notification *notif);