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
|
# NOTE: It might be helpful to run dunst -print in a terminal in order
|
||||||
# to find fitting options for rules.
|
# 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_everything]
|
||||||
# fullscreen = delay
|
# fullscreen = delay
|
||||||
#[fullscreen_show_critical]
|
#[fullscreen_show_critical]
|
||||||
|
@ -34,6 +34,7 @@ const char *enum_to_string_fullscreen(enum behavior_fullscreen in)
|
|||||||
switch (in) {
|
switch (in) {
|
||||||
case FS_SHOW: return "show";
|
case FS_SHOW: return "show";
|
||||||
case FS_DELAY: return "delay";
|
case FS_DELAY: return "delay";
|
||||||
|
case FS_PUSHBACK: return "pushback";
|
||||||
case FS_NULL: return "(null)";
|
case FS_NULL: return "(null)";
|
||||||
default:
|
default:
|
||||||
LOG_E("Enum behavior_fullscreen has wrong value.");
|
LOG_E("Enum behavior_fullscreen has wrong value.");
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
enum behavior_fullscreen {
|
enum behavior_fullscreen {
|
||||||
FS_NULL, //!< Invalid value
|
FS_NULL, //!< Invalid value
|
||||||
FS_DELAY, //!< Delay the notification until leaving fullscreen mode
|
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
|
FS_SHOW, //!< Show the message when in fullscreen mode
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -561,6 +561,8 @@ enum behavior_fullscreen parse_enum_fullscreen(const char *string, enum behavior
|
|||||||
return FS_SHOW;
|
return FS_SHOW;
|
||||||
else if (strcmp(string, "delay") == 0)
|
else if (strcmp(string, "delay") == 0)
|
||||||
return FS_DELAY;
|
return FS_DELAY;
|
||||||
|
else if (strcmp(string, "pushback") == 0)
|
||||||
|
return FS_PUSHBACK;
|
||||||
else {
|
else {
|
||||||
LOG_W("Unknown fullscreen value: '%s'\n", string);
|
LOG_W("Unknown fullscreen value: '%s'\n", string);
|
||||||
return def;
|
return def;
|
||||||
|
19
src/queues.c
19
src/queues.c
@ -332,6 +332,22 @@ void queues_update(bool fullscreen)
|
|||||||
return;
|
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 */
|
/* move notifications from queue to displayed */
|
||||||
GList *iter = g_queue_peek_head_link(waiting);
|
GList *iter = g_queue_peek_head_link(waiting);
|
||||||
while (iter) {
|
while (iter) {
|
||||||
@ -346,7 +362,8 @@ void queues_update(bool fullscreen)
|
|||||||
if (!n)
|
if (!n)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (fullscreen && n->fullscreen == FS_DELAY) {
|
if (fullscreen
|
||||||
|
&& (n->fullscreen == FS_DELAY || n->fullscreen == FS_PUSHBACK)) {
|
||||||
iter = nextiter;
|
iter = nextiter;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user