796 Commits

Author SHA1 Message Date
Nikos Tsipinakis
1d4a26c1d0 Merge pull request #303 from LukeShu/fix-warning-msg
option_parser: Fix inconsistent Warning message.
2017-02-26 13:16:42 +02:00
Luke Shumaker
bf01932471 option_parser: Fix inconsistent Warning message.
Usually, it's "Warning: invalid config file at line %d", but in one case
there's a colon after "line".
2017-02-25 21:27:49 -05:00
Nikos Tsipinakis
2126b212f6 Add example for the history_ignore rule to dunstrc
Add example to demonstrate the usage of history_ignore to the default
dunstrc file.

Relevant issue: #302
2017-02-25 15:38:54 +02:00
Nikos Tsipinakis
d8d267e1f0 ASSERT_FALSE(expr == NULL) -> ASSERT(expr)
Simplify assert calls to improve code readability.
2017-02-23 20:45:09 +02:00
Nikos Tsipinakis
c23af0e021 Don't leave zombie processes if dmenu call fails
If dmenu didn't return anything we returned out of the function without
calling `waitpid` to collect the childs exit code, leaving to the child
process to be left as a zombie indefinitely. This commit makes `waitpid`
be called before the return checks are done.
2017-02-23 20:24:45 +02:00
Nikos Tsipinakis
b034d31f80 Merge pull request #299 from LukeShu/fix-nl
Expand "\\n" to "\n" in the format string only; not message text.
2017-02-23 16:24:07 +02:00
Nikos Tsipinakis
375fcad223 Don't unconditionally append to dmenu_input
When generating the list of urls to pass to dmenu, string_append with a
newline as a separator was called unconditionally. This caused a newline
character to be added for each notification even if it didn't contain
any urls, leading to empty items in dmenu.

Fixes #300
2017-02-21 22:43:22 +02:00
Nikos Tsipinakis
f624c42432 Improve dbus error handling
* Improve error reporting to also include the glib error messages
* Call g_error_free after an error to avoid leaking memory.
2017-02-20 18:04:24 +02:00
Nikos Tsipinakis
37628f3dc4 Print errors to stderr
A lot of error reporting used a simple `printf` call which by default
prints to stdout. This was changed so that all error reporting is done
by an `fprintf(stderr, ...)` call.
2017-02-20 17:48:11 +02:00
Nikos Tsipinakis
fccdce0819 Remove shrink the shrink option from the changelog
`shrink` is already in 1.1.0 so it should not be listed as a new
feature.
2017-02-20 17:32:01 +02:00
Nikos Tsipinakis
2d53c898db Print usage information to stdout instead of stderr
It doesn't make much sense to print usage into to stderr. What's more is
that it prevents users from easily piping the output to other
programs(i.e. grep)
2017-02-20 17:28:54 +02:00
Nikos Tsipinakis
92e83a939f Remove a few more leftover memory allocation checks
According to the glib memory allocation documentation, if any memory
allocation calls fail the application will be terminated so there is no
need to check if the call succeeded.
2017-02-20 17:25:59 +02:00
Luke Shumaker
e37bbad2d7 Expand "\\n" to "\n" in the format string only; not message text.
This is consistent with other implementations; neither notification-daemon
or xfce4-notifyd expand "\n" in message text.
2017-02-20 03:48:26 -05:00
Eizen
4df1a4b731 Fix small bug 2017-02-19 17:11:19 -03:00
Nikos Tsipinakis
62fcfa66e8 Merge pull request #297 from Stebalien/dbus
Modernize the systemd unit a bit
2017-02-19 15:18:48 +02:00
Steven Allen
46e0a0e668 Add dunst documentation to the systemd unit. 2017-02-18 14:24:02 -08:00
Steven Allen
3775b44339 Change the systemd unit's WantedBy to default.target
multi-user.target isn't a valid user target and it doesn't make sense to run
dunst as a system service.

Eventually, this unit should probably be converted to use
graphical-session.target but it's a bit unclear how that's supposed to work
right now.
2017-02-18 14:20:40 -08:00
Steven Allen
6f45c6926d Change the systemd service to a dbus unit 2017-02-18 14:17:38 -08:00
Nikos Tsipinakis
6288fab2d1 Merge pull request #295 from Stebalien/patch-1
Allow dunst to be managed by systemd
2017-02-17 20:34:08 +02:00
Nikos Tsipinakis
f5a7f0359e Merge pull request #296 from quite/verbose
Makefile: just be verbose
2017-02-17 18:42:50 +02:00
Steven Allen
f995f1c607 Allow dunst to be managed by systemd
This should have no effect on systems without systemd; it just causes dunst to be started through systemd when possible.
2017-02-15 14:17:39 -08:00
Daniel Lublin
2cf42f3299 Makefile: just be verbose
Show what is happening during build etc, the way most other make-based
projects do.

There is thus no need for the options target. Additionally, this target
caused unnecessary rebuilds of ./dunst each and every time, even on
`make install`.
2017-02-15 13:31:51 +01:00
Nikos Tsipinakis
21b4194031 Merge pull request #292 from johnchen902/cleandebt
Fix `#include`s and use only glib for memory management
2017-02-14 18:51:15 +02:00
John Chen
8ba62dc78a Use g_malloc0 where appropriate; remove unneeded null check 2017-02-14 00:45:02 +08:00
John Chen
656846900a Fix missing * in option_parser.c 2017-02-14 00:45:02 +08:00
John Chen
17e2929ee7 Change malloc and related functions to glib ones.
* malloc  -> g_malloc
* realloc -> g_realloc
* free    -> g_free
* strdup  -> g_strdup
* strndup -> g_strndup
2017-02-14 00:44:53 +08:00
John Chen
7037afb2bc Fix include. Add empty lines between include layers. 2017-02-14 00:39:04 +08:00
Nikos Tsipinakis
50fd0fae9b Add missing dashes in the changelog
Add missing dashes separating the version number and the release date in
the changelog.
2017-02-12 21:35:38 +02:00
Nikos Tsipinakis
eb2fda4bde Default to the config.h default if markup is not set
If neither the new 'markup' option is set nor 'allow_markup' then
default to whatever mode is set in config.h.
2017-02-12 21:27:55 +02:00
Nikos Tsipinakis
faea58159c Don't try to parse previously non-existent 'allow_markup' cmdline argument 2017-02-12 21:23:34 +02:00
Nikos Tsipinakis
149f12ee16 Switch changelog to markdown format
* Actually update the changelog contents with all the changes since the
  last release
* Add release date for all previous releases
2017-02-12 21:23:34 +02:00
Nikos Tsipinakis
345a821d86 Use stdlibs boolean macros rather than Xlibs
'True' and 'False' are defined in Xlib.h

Since we use stdbool boolean 'true' and 'false' definitions in several
places, it's best not to mix boolean macros. So in the sake of
consistency switch to using the stdbool macros project-wide.
2017-02-12 21:17:38 +02:00
Nikos Tsipinakis
de20697a69 Rename hide_duplicates_count -> hide_duplicate_count 2017-02-12 21:17:38 +02:00
Eizen
ceddf57a31 Add history_ignore rule
Fixes #197
2017-02-11 15:35:32 -03:00
Eizen
3ef15065a3 Fix ignore_newline regardless of markup
Fix issue where ignore_newline wouldn't work with other markup options. Fixes #293
2017-02-11 15:33:59 -03:00
Nikos Tsipinakis
956f91f6a4 Fix issue with loading config files with lines bigger than BUFSIZ
To load each line of the configuration file we were previously using a
simple buffer of length BUFSIZ. BUFSIZ is a macro provided by glibc as
the 'recommended length for a buffer'. But since one of our users
encountered a situation where really long config lines were necessary
it's time to change that behaviour.

This commit changes the line reading from using fgets with a character
limit of BUFSIZ to simply using getline.

We initialize the buffer pointer to NULL since getline will
automatically allocate a big enough buffer for us if it's passed a NULL
pointer. After that we pass the same buffer pointer again since,
according to the getline manpage, getline will also call realloc on the
buffer if necessary. Which means the only thing we have to do is call
free() at the end of the parsing process.

Fixes #294
2017-02-11 18:00:11 +02:00
Nikos Tsipinakis
42a641c728 Take allow_markup into account if markup is not set
Preserve backwards compatibility for now, this might be removed for the
3.0 release later on.
2017-02-08 20:55:48 +02:00
Nikos Tsipinakis
3024aed739 Use MARKUP_NULL in the default rules
Fix regression that can cause an underflow by setting the markup_level
enum to a static value(-1).
2017-02-08 20:50:23 +02:00
Eizen
ec96871a0f Fix icon alignment with dynamic width 2017-02-06 17:11:26 -03:00
Nikos Tsipinakis
3f5257f285 Remove unused function string_to_argv 2017-02-05 13:05:52 +02:00
Nikos Tsipinakis
0c49b49254 Replace string_to_argv util function with g_shell_parse_argv
string_to_argv parsing was very simplistic and didn't properly handle
quotations. Since we are already using glib, g_shell_parse_argv serves
the same purpose with much better parsing and error handling.
2017-02-05 13:00:59 +02:00
Nikos Tsipinakis
f0808f8d3f Fix alignment setting documentation
`alignment` specifies the alignment of the text within the notifications,
not the alignment of the notifications themselves.
2017-02-05 13:00:59 +02:00
Nikos Tsipinakis
38856bc705 Fix wrong config path in notification test suite 2017-02-05 13:00:59 +02:00
Nikos Tsipinakis
4d55ccb0ee Check against MARKUP_NULL when checking if markup is set
Setting markup_mode to -1 might not work since in some implementations
enum might not be signed. For convenience, add a new enum value
`MARKUP_NULL` to serve the same purpose.
2017-02-05 13:00:59 +02:00
Eizen
51d5e57967 Update changelog and man page 2017-02-04 22:24:33 -03:00
Nikos Tsipinakis
d445661031 Add simple test for notification_replace_format 2017-02-04 22:10:51 +02:00
Nikos Tsipinakis
4e1b97f3cc Merge allow_markup and plain_text into markup
Merge the allow_markup and plain_text settings into a single setting.

These 2 settings had a similar function, allow_markup controlled whether
markup was parsed or stripped and plain_text whether the notification
was escaped and displayed as is.

To cover all the possible combinations of the settings mentioned above
`markup` can take the following values:

full:  The equivalent of allow_markup yes, plain_text no.
       Passes the text straight to pango with minimal parsing. All valid
       pango tags will be parsed.

strip: The equivalent of allow_markup no, plain_text no.
       Strips the markup using string_strip_delimited. The parsing is
       simplistic and if there are any unescaped '<' and/or '>'
       characters it might get tripped and strip out actual text.

       According to the GNOME notification specification, if a server
       doesn't support markup(and we don't advertise that we do if it is
       turned off) it should be stripped clientside, so this setting
       should rarely be used. It is mainly left in for compatibility
       with broken clients that don't follow the specification.

no:   The equivalent of allow_markup [yes/no](any value), plain_text
      yes.
      Makes the notification content be rendered as plain text
      regardless if it contains markup. Any Markup will be shown as
      regular text.

Markup inside 'format' will still be parsed regardless of what markup is
set to.

Closes #279
2017-02-04 22:10:51 +02:00
Nikos Tsipinakis
4aa4e93123 Format the settings file better 2017-02-04 22:10:51 +02:00
Eizen
0c7406f1ba Merge pull request #290 from 'EdwardBetts-master' 2017-02-01 12:45:18 -03:00
Edward Betts
d73526975e fix spelling mistakes 2017-02-01 10:02:01 +00:00