87 Commits

Author SHA1 Message Date
Nikos Tsipinakis
b1f64b266b Wake up after changing status via dunstctl 2020-05-01 15:35:23 +02:00
Benedikt Heine
7e92619967 Add ability to trigger action of latest notification
Currently triggers only the latest notification. TODO: implement it
either with ActionsAll or more favorable: with an optional paramter,
which should trigger only the action of a single notification.

The problem currently: I have got no ability to check the DBus docs, as
I'm on a bad internet connection.
2020-05-01 15:35:23 +02:00
Benedikt Heine
a3342d0ced Add debug command 2020-04-10 10:48:47 +02:00
Benedikt Heine
55f4971a92 Add DBus interface to control dunst 2020-04-10 10:47:12 +02:00
Nikos Tsipinakis
69e319c729 Invalidate actions after notification is closed 2020-03-31 15:27:16 +02:00
Benedikt Heine
52a8489043 Don't overflow when passing INT_MAX on DBus wire 2019-08-09 14:41:37 +02:00
Nikos Tsipinakis
59a87e4e99
Merge pull request #610 from bebehei/docs-retval
Use @retval in codedocs
2019-03-07 22:29:18 +02:00
Benedikt Heine
16fcbc9db9 Use @retval in codedocs 2019-03-06 21:14:52 +01:00
Michael Sloan
977a7a7ea4 New rule option: skip_display 2019-01-30 23:50:33 -08:00
Benedikt Heine
1e82c761c9 Add support for desktop-entry hints 2019-01-25 07:59:01 +01:00
Nikos Tsipinakis
c8c7d2e675
Merge pull request #587 from mgsloan/fix-notification-decode-error-handling
Fix handling of case where notification decode failure occurs
2019-01-13 17:48:02 +02:00
Michael Sloan
dd54709b9e Fix handling of case where notification decode failure occurs
I'm not sure whether this case can happen in the wild, but if
artifically exercising the condition, I noticed it behaves
poorly. Specifically:

* The error_name parameter must be a valid D-Bus error name. It seems
  conventional to set this to "org.freedesktop.Notifications.Error".
  Without this change, the following error is thrown:

  CRITICAL: g_dbus_method_invocation_return_dbus_error: assertion 'error_name != NULL && g_dbus_is_name (error_name)' failed

* Previously execution would continue even though the notification did
  not decode, causing essentially a null pointer exception later.
  Adds a return for this case.

* With those two things fixed, this case seems relatively silent -
  "notify-send" invocations succeed even if the condition for the if
  is "true". So, I added a warning log to indicate that this case is
  occurring
2019-01-13 01:15:19 -08:00
Benedikt Heine
6f8b53c4e8 Compare raw icons by their checksums
Currently, we just skipped the notification comparison, if the
notification had a raw icon attached. This is a bit counterintuitive.

Calculating a checksum of the raw icon's data is the solution.

For that we cache the pixel buffer and introduce a field, which saves
the current icon's id. The icon_id may be a path or a hash.
So you can compare two notifications by their icon_id field regardless
of their icon type by their icon_id field.
2019-01-11 13:10:37 +01:00
Benedikt Heine
088907488c Rename icon field to iconname 2019-01-07 17:56:00 +01:00
Benedikt Heine
8579b3ed6b Add assertion macro to return values
Just recently, I started using g_return_val_if_fail as a brief assertion
checker. It'll also exit the function with a specified return value.

But actually this introduces some weird behavior. It's configurable by
environment variables and it'll print out a log message, if the
expression didn't validate properly. But some of these assertions are
actually ment to be silent.

Using a simple macro makes it simple to structure the assertions and its
return values in a block at the start of a function or anywhere else.
2019-01-07 15:30:42 +01:00
Benedikt Heine
5ebedab78b Fix maybe uninitialized variable 2018-12-29 14:38:59 +01:00
Benedikt Heine
63f455276f Print correct ID for foreign DBus service
By providing an additional layer of pointers, the printed PID was
actually the value at the PID's memory position. 🙈
2018-12-29 14:38:59 +01:00
Benedikt Heine
57a6baae85 Test FDN Daemon info 2018-12-29 14:38:59 +01:00
Benedikt Heine
ae58207f9b Use binary search for functions 2018-12-29 14:38:58 +01:00
Benedikt Heine
c35801b3ab Use a macro for method callbacks 2018-12-29 14:36:50 +01:00
Benedikt Heine
4fbb8fa75b Prefix dbus callbacks with dbus_cb_ 2018-12-29 14:31:31 +01:00
Benedikt Heine
b10bb292c6 Simplify DBus notification assembly 2018-12-29 14:31:31 +01:00
Benedikt Heine
52885ca6ad Use a hashtable for notification actions
As g_strv_contains is only available in GLib >= 2.44, we have to bump
the GLib requirements and the CI distros, too.
2018-12-29 14:30:55 +01:00
Benedikt Heine
c3cd623f41 Use notification_colors struct for notification colors 2018-11-26 17:31:46 +01:00
Benedikt Heine
e82b7bfb2d Use return value as success indicator 2018-11-21 10:55:44 +01:00
Benedikt Heine
92543cce22 Remove GLib requirement check
The requirement for GLib above 2.36 is already included in the
configuration file. So this type check is redundant.
2018-11-20 19:50:15 +01:00
Jordan Galby
d879d70da0 Implement stack_tag, implementing x-canonical-private-synchronous
Implements "x-dunst-stack-tag", "x-canonical-private-synchronous",
"private-synchronous", and "synchronous" hints via the "stack_tag" feature.
2018-11-10 14:59:32 +01:00
Benedikt Heine
851f8a7339 Rename dbus methods consistently 2018-10-31 15:19:24 +01:00
Nikos Tsipinakis
f12f1094ed
Merge pull request #550 from bebehei/misc
Misc patches
2018-10-10 17:59:30 +03:00
Benedikt Heine
c0e2a2a7e3 Move all strcmp operations to STR*EQ macros 2018-10-09 10:08:17 +02:00
Benedikt Heine
974bcb776e Remember if the notification is living on a valid connection
The notification spec says, that a notification gets invalidated when
closed. So the client won't listen anymore to ActionInvoked signals and
won't listen to NotificationClosed signals.

Remembering the actual status of the notification helps the standard and
makes the behavior clearer.
2018-10-06 13:44:01 +02:00
Benedikt Heine
837b4fe125 Implement refcounting for notifications 2018-10-06 13:43:49 +02:00
Benedikt Heine
4b5cc2c9bc Remove superfluous fflush call
The blame reveals commit 820cfe73, which introduced printing of
notifications similar to notification_print(). The fflush call is still
left over since porting the printfs into their dedicated method.

As notification_print() is called after this fflush() call, it's not
necessary anymore.
2018-10-01 14:58:36 +02:00
Benedikt Heine
bbbddad3a7 Use structs for notifications 2018-09-16 02:58:31 +02:00
Benedikt Heine
de0f0bf3d9 Pack type RawImage into raw_image struct 2018-09-16 02:58:26 +02:00
Benedikt Heine
8010f83286 Pack Actions type into struct actions 2018-09-16 02:58:23 +02:00
Benedikt Heine
3c69e1f263 Remove doubly variables while converting dbus message 2018-07-10 13:35:51 +02:00
Benedikt Heine
f410f57211 Use g_clear_pointer on fields, which may get reused 2018-07-07 11:53:32 +02:00
Benedikt Heine
e4b0aae05a Replace free(val); val=NULL; with g_clear_pointer 2018-07-07 11:51:03 +02:00
sh!zeeg
aa5ccd7dd7 per section 'frame_color' parameter 2018-03-08 21:33:28 +03:00
Benedikt Heine
19b364d67c Translate fprintf statements into log messages 2018-02-02 17:29:04 +01:00
Benedikt Heine
5f4d9c6685 Query the Notification Server name when dying 2018-01-05 18:13:26 +01:00
Benedikt Heine
3c7f8409f0 Output the PID of the current FDN daemon
When the DBus name lost function is called, either the whole DBus
connection is lost, or another rivaling FDN daemon acquired the name.
Without enough experience, this is impossible to trace back and examine
further.

To make it easier for new users, dunst prints out the PID of the
process, which currently acquired the FDN DBus name.
2017-12-19 10:04:03 +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
09c1ca7127 Pack FDN specific names into macro 2017-12-16 16:30:40 +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
e51ac67715
Merge pull request #453 from tsipinakis/fix-emiting-signal-on-redisplayed
Don't emit NotificationClosed signal on redisplayed notifications
2017-12-10 16:00:11 +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
16aefbabe3 Distinguish DBus connection and name acquired error
Distinguish between a failure to connect to DBus and a failure to
connect to the actual FDN DBus path.

This is possible, because `on_name_acquired` gets its DBus connection
passed as a parameter. If this parameter is NULL, there is no connection
established and the DBus name is not lost, because another notification
daemon is running.
2017-12-07 02:37:34 +01:00
Benedikt Heine
4bfae81f18 Split and refactor notification_init
Unboil the spaghetti code and split it into separate methods.
2017-12-04 20:27:33 +01:00