1023 Commits

Author SHA1 Message Date
Benedikt Heine
3face4ae72 Split notification assembly into separate method
Handle replaces_id now via n->id
2017-12-15 00:16:31 +01:00
Benedikt Heine
b97a49c09b Fix memory leak colors given via hints
The hints given via DBus are not constants. Therefore the color fields
have to get freed during notification cleanup. As it's not possible to
disinguish, which field is constant, we have to duplicate the settings
on assignment.
2017-12-15 00:16:31 +01:00
Benedikt Heine
98d905b8e4 Strip [linktext] before opening URL
[linktext] can contain arbitary data and also a possible URL, which
would get passed to the browser, making the actual URL invalid.
2017-12-15 00:16:31 +01:00
Benedikt Heine
acd8be51ab Remove a and img tags from msg
While the notification spec allows tags like <a href="...">...</a> and
<img src="..." alt="...">, pango cannot parse these tags and therefore
these tags should be removed before passed to pango.

Also the method notification_extract_markup_urls is not needed anymore,
as markup_strip_a can return URLs optionally.

This implies, that URL replacement is now indicated via show_indicators
for URLs and the dmenu string is in the format of
'[text between a tags] URL\n'. This is similarly handled for images,
too.
2017-12-15 00:16:31 +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
Benedikt Heine
eae071f330 Rename color_strings to colors
This is an antipattern and makes linelength increase for nothing
2017-11-25 10:58:25 +01:00
Benedikt Heine
d190af6db1 Restructure notification struct and add comments 2017-11-25 10:58:25 +01:00
Benedikt Heine
714731e8fc
Merge pull request #447 from bebehei/image-path
Support image-path hint
2017-11-25 10:56:47 +01:00
Nikos Tsipinakis
62e8b043c7
Merge pull request #448 from bebehei/style
Style adaptions
2017-11-25 09:43:28 +02:00
Benedikt Heine
0ad63d2c2c Don't indent switch labels 2017-11-25 02:16:45 +01:00
Benedikt Heine
5b2a6e57b7 curly braces style
Curly braces should start on a new line, after a method declaration, but
should continue on the same line after a control structure.
2017-11-25 02:15:30 +01:00
Benedikt Heine
bd8fd8b1d2 Improve whitespace handling 2017-11-25 01:38:28 +01:00
Benedikt Heine
fc4f0a4238 Refactor arguments into one line
Parameters should not cover an area. All arguments should be on a single
line (either horizontally or vertically).
2017-11-25 01:32:06 +01:00
Benedikt Heine
caa63d6275 Sort includes alphabetically 2017-11-25 01:28:03 +01:00
Benedikt Heine
34ee1744dd Support image-path hint
As GApplications expose their icon via image-path hint and not via the
actual app_icon field, GApplication icons haven't been displayed before.

According to the notification spec, image-path hint should also override
the app_icon as follows:

1. image-data hint
2. image-path hint
3. app_icon parameter
2017-11-25 00:23:19 +01:00
Benedikt Heine
7191104147
Merge pull request #444 from bebehei/dunstify-utf8-icon
Set Locale in dunstify
2017-11-24 02:35:33 +01:00
Benedikt Heine
664ec413aa Set Locale in dunstify
If specifying --icon with UTF-8 characters, the g_option_context_parse
fails with an invalid byte conversion. The solution is to set the locale
explicitly.

For more info, see the GLib issue tracker:
https://bugzilla.gnome.org/show_bug.cgi?id=737137

Fixes #443
2017-11-23 11:43:52 +01:00
Benedikt Heine
6e9a805017
Merge pull request #439 from bebehei/duplicate-notifications
Duplicate notifications
2017-11-22 18:25:37 +01:00
Benedikt Heine
e84922a484
Merge pull request #440 from bebehei/enums
Use more enums
2017-11-22 18:25:19 +01:00
Nikos Tsipinakis
9382cbbd15
Merge pull request #442 from tsipinakis/dunstify-printid
Dunstify: Print id before blocking
2017-11-22 18:23:43 +02:00
Nikos Tsipinakis
51a98b8fd0 Dunstify: Print id before blocking
Print the notification id, if requested, before blocking to catch action
return or NotificationClosed signal since once of those events happens
the program will exit without further action, bypassing the id printing
logic.
2017-11-22 17:49:50 +02:00
Benedikt Heine
823665a3bd Sanitize negative urgency correctly 2017-11-21 16:19:40 +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
Nikos Tsipinakis
73eaa25690
Merge pull request #441 from bebehei/align-dunstify-args
Align columns in dunstify option list
2017-11-16 22:10:31 +02:00
Benedikt Heine
744712ad77 Use enum for close reason 2017-11-16 18:05:46 +01:00
Benedikt Heine
5f51147263 Prefix urgency enum with URG_ 2017-11-16 17:12:30 +01:00
Benedikt Heine
d91053c85e Use enum for urgency 2017-11-16 17:10:28 +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
Nikos Tsipinakis
fd81bd1908
Merge pull request #364 from SteveJones/master
Fix handling of non V1.5 XRandr.
2017-11-04 08:34:49 +02:00
Benedikt Heine
4cf9114028 Require XRandR 1.5 in pkg-config to compile
Albeit it's possible to run with XRandR extension < 1.5,
dunst needs the headers of libxrandr 1.5.
2017-11-02 15:31:53 +01:00
Benedikt Heine
1e51edc0df Fix handling of non V1.5 XRandR
Due to the way Xlib handles errors XRRGetMonitors will cause dunst to exit if
the server doesn't support version 1.5 of RandR. The check for null is
effectively dead code but in theory the number of monitors can be < 1 so treat
this as an error. Change the code to fetch the RandR version and fallback if
the version is less than 1.5 when getting monitors.

This fix was brought up by @SteveJones on GitHub
2017-11-02 15:31:19 +01:00
Nikos Tsipinakis
76857b6e7c
Merge pull request #423 from bebehei/optimize_icons
Optimize icons
2017-11-02 07:54:41 +02:00
Nikos Tsipinakis
c481760ae1
Merge pull request #424 from bebehei/timeout-fixes
Fixup fields to count in monotonic usec time
2017-11-02 07:36:23 +02:00
Nikos Tsipinakis
48fab3f887
Merge pull request #426 from bebehei/progress
Use '-1' for undefined progress
2017-11-02 07:29:29 +02:00
Benedikt Heine
11af7402fa Use '-1' for undefined progress 2017-10-31 15:58:41 +01:00
Benedikt Heine
1f4d03af9c Fixup fields to count in monotonic usec time 2017-10-31 12:53:39 +01:00
Benedikt Heine
b571698f52 Free Actions in separate method
Also free the memory of the actual Action.
2017-10-31 12:49:19 +01:00
Benedikt Heine
23cae3110d Optimize out icon_overridden
There is no need save if the icon field should have precedence, as
setting raw_icon to NULL emphasizes the same.

Also freeing raw_icon saves unneccessary memory.
2017-10-31 12:49:16 +01:00
Benedikt Heine
13ed6301d8 Add separate function to free RawImage 2017-10-31 12:49:07 +01:00
Nikos Tsipinakis
e111f5393e
Merge pull request #411 from bebehei/refactor-queues
Refactor queues
2017-10-31 07:56:38 +02: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