Add pushback mode
This commit is contained in:
parent
0f46564e97
commit
aa5cc977cc
7
dunstrc
7
dunstrc
@ -294,6 +294,13 @@
|
||||
# NOTE: It might be helpful to run dunst -print in a terminal in order
|
||||
# to find fitting options for rules.
|
||||
|
||||
# fullscreen values
|
||||
# show: show the notifications, regardless if there is a fullscreen window opened
|
||||
# delay: displays the new notification, if there is there is no fullscreen window active
|
||||
# If the notification is already drawn, it won't get undrawn.
|
||||
# pushback: same as delay, but when switching into fullscreen, the notification will get
|
||||
# withdrawn from screen again and will get delayed like a new notification
|
||||
|
||||
#[fullscreen_delay_everything]
|
||||
# fullscreen = delay
|
||||
#[fullscreen_show_critical]
|
||||
|
@ -34,6 +34,7 @@ const char *enum_to_string_fullscreen(enum behavior_fullscreen in)
|
||||
switch (in) {
|
||||
case FS_SHOW: return "show";
|
||||
case FS_DELAY: return "delay";
|
||||
case FS_PUSHBACK: return "pushback";
|
||||
case FS_NULL: return "(null)";
|
||||
default:
|
||||
LOG_E("Enum behavior_fullscreen has wrong value.");
|
||||
|
@ -10,9 +10,10 @@
|
||||
#define DUNST_NOTIF_MAX_CHARS 5000
|
||||
|
||||
enum behavior_fullscreen {
|
||||
FS_NULL, //!< Invalid value
|
||||
FS_DELAY, //!< Delay the notification until leaving fullscreen mode
|
||||
FS_SHOW, //!< Show the message when in fullscreen mode
|
||||
FS_NULL, //!< Invalid value
|
||||
FS_DELAY, //!< Delay the notification until leaving fullscreen mode
|
||||
FS_PUSHBACK, //!< When entering fullscreen mode, push the notification back to waiting
|
||||
FS_SHOW, //!< Show the message when in fullscreen mode
|
||||
};
|
||||
|
||||
/// Representing the urgencies according to the notification spec
|
||||
|
@ -561,6 +561,8 @@ enum behavior_fullscreen parse_enum_fullscreen(const char *string, enum behavior
|
||||
return FS_SHOW;
|
||||
else if (strcmp(string, "delay") == 0)
|
||||
return FS_DELAY;
|
||||
else if (strcmp(string, "pushback") == 0)
|
||||
return FS_PUSHBACK;
|
||||
else {
|
||||
LOG_W("Unknown fullscreen value: '%s'\n", string);
|
||||
return def;
|
||||
|
19
src/queues.c
19
src/queues.c
@ -332,6 +332,22 @@ void queues_update(bool fullscreen)
|
||||
return;
|
||||
}
|
||||
|
||||
/* move notifications back to queue, which are set to pushback */
|
||||
if (fullscreen) {
|
||||
GList *iter = g_queue_peek_head_link(displayed);
|
||||
while (iter) {
|
||||
notification *n = iter->data;
|
||||
GList *nextiter = iter->next;
|
||||
|
||||
if (n->fullscreen == FS_PUSHBACK){
|
||||
g_queue_delete_link(displayed, iter);
|
||||
g_queue_insert_sorted(waiting, n, notification_cmp_data, NULL);
|
||||
}
|
||||
|
||||
iter = nextiter;
|
||||
}
|
||||
}
|
||||
|
||||
/* move notifications from queue to displayed */
|
||||
GList *iter = g_queue_peek_head_link(waiting);
|
||||
while (iter) {
|
||||
@ -346,7 +362,8 @@ void queues_update(bool fullscreen)
|
||||
if (!n)
|
||||
return;
|
||||
|
||||
if (fullscreen && n->fullscreen == FS_DELAY) {
|
||||
if (fullscreen
|
||||
&& (n->fullscreen == FS_DELAY || n->fullscreen == FS_PUSHBACK)) {
|
||||
iter = nextiter;
|
||||
continue;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user