File: types.h

package info (click to toggle)
mako-notifier 1.10.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 496 kB
  • sloc: ansic: 6,081; xml: 240; makefile: 6
file content (79 lines) | stat: -rw-r--r-- 2,150 bytes parent folder | download | duplicates (2)
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#ifndef MAKO_TYPES_H
#define MAKO_TYPES_H

#include <stdbool.h>
#include <stdint.h>
#include <cairo.h>
#include "wlr-layer-shell-unstable-v1-client-protocol.h"

struct mako_color {
	uint32_t value;
	cairo_operator_t operator;
};

bool parse_boolean(const char *string, bool *out);
bool parse_int(const char *string, int *out);
bool parse_int_ge(const char *string, int *out, int min);
bool parse_color(const char *string, uint32_t *out);
bool parse_mako_color(const char *string, struct mako_color *out);
bool parse_anchor(const char *string, uint32_t *out);

enum mako_notification_urgency {
	MAKO_NOTIFICATION_URGENCY_LOW = 0,
	MAKO_NOTIFICATION_URGENCY_NORMAL = 1,
	MAKO_NOTIFICATION_URGENCY_CRITICAL = 2,
	MAKO_NOTIFICATION_URGENCY_UNKNOWN = -1,
};

bool parse_urgency(const char *string, enum mako_notification_urgency *out);

struct mako_directional {
	int32_t top;
	int32_t right;
	int32_t bottom;
	int32_t left;
};

bool parse_directional(const char *string, struct mako_directional *out);

// Criteria specifications are used for two things.
// Primarily, they keep track of whether or not each field was part of the a
// criteria specification, so that, for example, "not actionable" can be
// distinguished from "don't care".
// Additionally, they are used to store the set of criteria that must match for
// notifications to group with each other.
struct mako_criteria_spec {
	bool app_name;
	bool app_icon;
	bool actionable;
	bool expiring;
	bool urgency;
	bool category;
	bool desktop_entry;
	bool summary;
	bool summary_pattern;
	bool body;
	bool body_pattern;

	bool mode;

	bool none; // Special criteria that never matches, used for grouping

	// Fields that can only be matched after grouping, and thus can't be
	// used to group.
	bool group_index;
	bool grouped;
	bool output;
	bool anchor;
	bool hidden;
};

bool parse_criteria_spec(const char *string, struct mako_criteria_spec *out);
bool mako_criteria_spec_any(const struct mako_criteria_spec *spec);

// List of specifier characters that can appear in a format string.
extern const char VALID_FORMAT_SPECIFIERS[];

bool parse_format(const char *string, char **out);

#endif