Dunst
Lightweight notification daemon
Loading...
Searching...
No Matches
rules.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: BSD-3-Clause */
10
11#ifndef DUNST_RULES_H
12#define DUNST_RULES_H
13
14#include <glib.h>
15#include <stdbool.h>
16
17#include "notification.h"
18#include "settings.h"
19
20struct rule {
21 // Since there's heavy use of offsets from this class, both in rules.c
22 // and in settings_data.h the layout of the class should not be
23 // changed, unless it's well considered and tested. See the comments
24 // below for what should not be changed.
25
26 // This has to be the first member, see struct setting.rule_offset.
27 char *name;
28
29 /* filters */
30 char *appname; // this has to be the first filter, see rules.c
31 char *summary;
32 char *body;
33 char *icon;
34 char *category;
35 char *stack_tag;
36 char *desktop_entry;
37 int msg_urgency;
38 gint64 match_dbus_timeout;
39
40 /* modifying */
41 gint64 timeout; // this has to be the first modifying rule
42 gint64 override_dbus_timeout;
43 enum urgency urgency;
44 char *action_name;
45 enum markup_mode markup;
46 gint history_ignore;
47 gint match_transient;
48 gint set_transient;
49 gint skip_display;
50 gint word_wrap;
51 int ellipsize;
52 int alignment;
53 gint hide_text;
54 int icon_position;
55 int min_icon_size;
56 int max_icon_size;
57 int override_pause_level;
58 char *new_icon;
59 char *default_icon;
60 struct color fg;
61 struct color bg;
62 struct gradient *highlight;
63 struct color fc;
64 char *set_category;
65 char *format;
66 char *script;
67 enum behavior_fullscreen fullscreen;
68 bool enabled;
69 int progress_bar_alignment;
70 char *set_stack_tag; // this has to be the last modifying rule
71};
72
73extern GSList *rules;
74
85struct rule *rule_new(const char *name);
86
87void rule_free(struct rule *r);
88
89void rule_print(const struct rule *r);
90void rule_apply(struct rule *r, struct notification *n, bool save);
91void rule_apply_all(struct notification *n);
92bool rule_matches_notification(struct rule *r, struct notification *n);
93
99struct rule *get_rule(const char* name);
100
106bool rule_offset_is_modifying(const size_t offset);
107
113bool rule_offset_is_filter(const size_t offset);
114
115#endif
Notification type definitions.
behavior_fullscreen
struct rule * get_rule(const char *name)
Get rule with this name from rules.
Definition rules.c:336
struct rule * rule_new(const char *name)
Allocate a new rule with given name.
Definition rules.c:237
bool rule_offset_is_modifying(const size_t offset)
Check if a rule is an action.
Definition rules.c:348
bool rule_offset_is_filter(const size_t offset)
Check if a rule is an filter.
Definition rules.c:357
Type definitions for settings.
Definition draw.h:48
Definition rules.h:20