41 Commits

Author SHA1 Message Date
Benedikt Heine
34e97b3e94 Optimize freshly introduced queues_update code 2018-09-14 15:37:12 +02:00
Benedikt Heine
4c26ab442a Use the first waiting notification to generate xmore
Using the last notification from displayed creates confusion about
nonexisting notifications.
2018-09-13 12:08:41 +02:00
Benedikt Heine
f14b0b2b4a Show xmore layout only when needed
For the case, that there is a single notification waiting in queue, the
xmore layout is an annoying setting.
2018-09-13 12:08:41 +02:00
Benedikt Heine
ec26403a06 Let important notifications seep into full display queue
When the display queue had is full and a new notification would come
in, new notification wouldn't get shown until a currently displayed
notification would timeout.

Even if the notification would have been shown on top of the displayed
queue. So e.g. if the displayed queue would have been filled with
"normal" urgency notifications, an incoming "urgent" notification would
have been delayed.

To let those more important notifications through, the tail of displayed
and head of waiting are swapped on every update if necessary.
2018-09-13 11:14:33 +02:00
Benedikt Heine
c692d222d7 Save the notification's scriptrun in script_run field 2018-09-13 11:14:33 +02:00
Benedikt Heine
faec6bdbca Wakeup also for infinite notifs when set show_age_threshold
For notifications without any timeout, ttl can't be positive.
So when, show_age_threshold is active, dunst won't wake up, if there
are only notifications displayed without any timeout.
2018-09-06 11:13:46 +02:00
David Sauerwein
bb60ea7a48 Add a toggle command 2018-08-11 11:08:03 +02:00
Benedikt Heine
ac4a0becd2 Count monotonic time with Linux specific clocks
On Linux, CLOCK_MONOTONIC has got a bug. It does not count
onwards during sleep, albeit required by POSIX. This behavior
is reasoned with the requirement for poll().
Also the GLib people are sticking to this behavior in their
g_get_monotonic_time() function.

So we have to use a drop in replacement, which respects CLOCK_BOOTTIME
on Linux, as this is the clock, what would be CLOCK_MONOTONIC on POSIX
systems.
2018-03-20 14:17:03 +01:00
Benedikt Heine
aa5cc977cc Add pushback mode 2018-02-25 20:18:40 +01:00
Benedikt Heine
f89ce8e16f Delay incoming notifications when fullscreens set 2018-02-25 20:18:40 +01:00
Benedikt Heine
422f353243 Add initial doxygen documentation 2018-02-22 20:08:00 +01:00
Benedikt Heine
c4eb26e3f5 Remove unnecessary return value 2018-02-20 17:05:55 +01:00
Benedikt Heine
3b6c5299be Use void as argument for parameterless functions 2018-02-20 16:24:00 +01:00
Benedikt Heine
19b364d67c Translate fprintf statements into log messages 2018-02-02 17:29:04 +01:00
Benedikt Heine
35dbd00611
Merge pull request #428 from bebehei/refactor-notification_init
Refactor notification init
2017-12-18 00:55:59 +01:00
Benedikt Heine
3face4ae72 Split notification assembly into separate method
Handle replaces_id now via n->id
2017-12-15 00:16:31 +01:00
Nikos Tsipinakis
0c8d3a4084 Don't emit NotificationClosed signal on redisplayed notifications
The signal_notification_closed function is called even when a
notification has been pulled from history and re-emits the
NotificationClosed signal, this can confuse clients since multiple such
signals are not accounted for in the spec.
2017-12-09 17:12:31 +02:00
Nikos Tsipinakis
ff6f3e496c Prefix signal functions with signal_
Make dbus function that emit a signal easier to distinguish by prefixing
them with 'signal_'.
2017-12-09 17:03:56 +02:00
Benedikt Heine
6e9a805017
Merge pull request #439 from bebehei/duplicate-notifications
Duplicate notifications
2017-11-22 18:25:37 +01:00
Benedikt Heine
20807a09b0 Validate closing reasons inside dbus method
Also fixes a nice off by one error. According to notification spec, the
reason 0 doesn't exist, while the undefined reason wouldn't have been
sent.
2017-11-21 16:17:47 +01:00
Benedikt Heine
744712ad77 Use enum for close reason 2017-11-16 18:05:46 +01:00
Benedikt Heine
03c8301c26 Free old notifications when replaced
Do not push old notifications to history, as there would be multiple
notifications around with the same ID.
2017-11-15 17:10:56 +01:00
Benedikt Heine
1162f53f8c Change queues_stack_duplicate signature to bool 2017-11-15 17:10:56 +01:00
Benedikt Heine
7a057b0b2e Close old notification when stacking
Notification spec prohibits to reuse notification IDs (unless uint32 is
exhausted). Therefore returning the same ID twice must not happen.

Sending a signal, that the old notification timed out makes most sense.
It wasn't closed by the user, nor by a CloseNotification call either.
When we stack notifications, no interaction happened (the equivalent
of timing out).
2017-11-15 14:39:43 +01:00
Nikos Tsipinakis
62e50289f0
Merge pull request #425 from bebehei/memory-leak_history-ignore
Free notifications ignored in history
2017-11-07 13:53:22 +02:00
Benedikt Heine
b7677affeb Free notifications ignored in history
Notifications having set the history_ignore hint (and by default
also transient notifications) have not been freed.
2017-11-07 12:33:58 +01:00
Benedikt Heine
1f4d03af9c Fixup fields to count in monotonic usec time 2017-10-31 12:53:39 +01:00
Benedikt Heine
b57483416e Remove command handling from notification_init 2017-10-29 20:38:40 +01:00
Benedikt Heine
616b8a1758 Rename queue to waiting
This gives all three queues unique names makes it easier to trace back,
which queue should hold which notifications.
2017-10-29 20:38:40 +01:00
Benedikt Heine
a536e3f60b Force management of queues to queues.c 2017-10-29 20:38:40 +01:00
Benedikt Heine
e3881766c0 Refactor history_* functions to match queues namespace 2017-10-29 20:38:40 +01:00
Benedikt Heine
38e4bbb7bb Refactor notification_* functions to match queues namespace 2017-10-29 20:38:40 +01:00
Benedikt Heine
12fa9d6ce1 Move update_lists and check_timeouts to queues.c
Also refactor the names to match the namespace.
2017-10-29 20:38:40 +01:00
Benedikt Heine
c70da444a9 Move pause_display to queues.c
Hint for dbus.c lines (134,138):

pause_display => (displayed->length == 0)
2017-10-29 20:38:40 +01:00
Benedikt Heine
59ac6d0f88 Move get_sleep_time to queues.c 2017-10-29 20:38:40 +01:00
Benedikt Heine
3fab4c470b Increment id counter only for displayed notifications
Previously for every notification (also stacked ones), a new
notification id was used, even if the notification got discarded.
2017-10-29 20:38:40 +01:00
Benedikt Heine
f869175d0d Move id assignment to separate function in queues.c
Move all id-changing functions out of notification_init and handle this
in queues.c

Also use stack_duplicates in combination with replacement of
notifications correctly. Fixes #404 (issue not found)
2017-10-29 20:38:40 +01:00
Benedikt Heine
af9f6b8b7d Move maximum notification display count to x11
Decouple the x11 stuff from dunst.c, to be able to push update_lists to
queues.c in the next commit
2017-10-29 20:38:40 +01:00
Benedikt Heine
7110734b6e Move queue initialization to queues.c 2017-10-29 20:38:40 +01:00
Benedikt Heine
7f335b79d2 Uncouple dunst.h from queues.c again 2017-10-29 20:38:40 +01:00
Benedikt Heine
a7003e3616 Refactor: Move queue specific methods to queues.c 2017-10-29 20:38:40 +01:00