561 Commits

Author SHA1 Message Date
Nikos Tsipinakis
eb0a0f8602 Fix infinite loop when checking timeouts
Move the iter pointer to the next item before doing any logic that might
result in exiting from the current iteration of the loop since it would
cause the same notification to be processed repeatedly resulting in an
infinite loop.

Fixes 362.
2017-08-19 20:37:54 +03:00
Benedikt Heine
d4f6726944 Add rule to ignore transient settings 2017-08-19 12:46:33 +02:00
Benedikt Heine
02ba060490 Refactor if chain to avoid nested statements 2017-08-19 12:46:00 +02:00
Benedikt Heine
585f0f85e0 Add support for transistent hints 2017-08-19 12:46:00 +02:00
Nikos Tsipinakis
3c257eaeb7 Merge pull request #351 from bebehei/wordexp
replace variables and ~ in script paths
2017-08-19 10:12:16 +03:00
Benedikt Heine
8e3a7586d1 replace ~/ in script paths 2017-08-15 23:35:02 +02:00
Dmitri Goutnik
bf98183098 Add libgen.h include and guard against basename(3) modifying its arg 2017-08-15 10:44:32 -05:00
Nikos Tsipinakis
99c74b8703 Merge pull request #352 from bebehei/nextiter
Optimize check_timeouts
2017-08-15 11:49:45 +03:00
Benedikt Heine
66fceb9661 handle removing of elements in GList correctly
When closing a notification in check_timeouts, iter will get removed
of the list and therefore iter->next is NULL at the end of the
loop. This requires calling check_timeouts again.

Shifting iter to iter->next before removing the notification, we can
avoid recalling check_timeouts and avoid processing the already
processed list again.
2017-08-14 11:00:33 +02:00
Steven Schäfer
d61a6183a5 parse raw icons from the (deprecated) image_data attribute 2017-08-06 22:11:10 +02:00
Benedikt Heine
b7ff4f9f1f print usage only on stdout 2017-08-04 09:55:59 +02:00
Nikos Tsipinakis
f14301292c Merge pull request #346 from bebehei/reorder-getopt
change order of option_get_* to be displayed during --help
2017-08-01 19:26:51 +03:00
George Angelopoulos
9acb9fd255 add backwards compatibility for icon_folders option
Existing configurations will continue to work but now print a warning.
New, icon_path option takes precedence if both options are used.
If icon_folders option is used, its usage string also appears in --help
output.
2017-08-01 12:51:00 +02:00
Benedikt Heine
677e1f14ca change order of option_get_* to be displayed during --help 2017-08-01 12:21:55 +02:00
George Angelopoulos
4d03acc454 replace 'folder' with 'path' in icon functionality
"folder" is more of a windows term. In unix we have paths and
directories.
2017-07-29 15:16:08 +02:00
Benedikt Heine
7443021897 fix typos and reformat print output 2017-07-24 22:31:06 +02:00
Benedikt Heine
c9980347cf improve readability in dbus.c 2017-07-23 02:12:10 +02:00
Nikos Tsipinakis
86cbc1d34b Make icon set via rules take priority over raw icons
When a notification contains both a raw icon and an icon path according
to the GNOME notification specification the raw icon should take
priority over anything else.

If, however, a user uses the new_icon rule to set a custom icon on a
notification, that rule overwrote the icon path and not the raw icon
and as a result the raw icon was displayed in place of the user
specified one.

As a simple fix, a new icon_overridden boolean was added to the
notification struct indicating if a custom icon has been set. If so, the
icon path should take priority over the raw icon.

Fixes #339
2017-07-19 09:13:19 +03:00
Nikos Tsipinakis
599db75401 Add deprecation warning for the frame section 2017-07-11 11:08:36 +03:00
Nikos Tsipinakis
842a35db06 Make per_monitor_dpi take precedence over Xft.dpi
If the per-monitor dpi feature has been enabled it shouldn't be overridden
just because an Xft.dpi value is set, it's possibly for other programs
that don't have such a feature.
2017-07-11 10:12:56 +03:00
Nikos Tsipinakis
c547f6eec9 Add force_xinerama option
Since after the release a lot of downstream users will not be building
from source, it makes a lot more sense to have an option to fall back to
the Xinerama extension for those that are still on systems that do not
support RandR.
2017-07-10 14:38:20 +03:00
Nikos Tsipinakis
44ac026d97 Add format string for raw progress value
While it's not the best solution, it should cover most use cases where a
custom format on the progress value is required. If any further
customization is needed, the only current alternative is to use rules
to override the format.

Closes #273
2017-07-09 20:20:49 +03:00
Benedikt Heine
717c747a8c truncate overlong messages (fixes #248)
Displaying too heavy notifications can DoS dunst. For example bad
programs, which pipe raw image data into the notification.
Limiting the maximum character length to 5000 circumvents this.

5000 should be ridiculously high to prevent DoS while still not
truncating all correct notifications.
2017-07-09 16:34:47 +02:00
Nikos Tsipinakis
a08fba49d0 Remove bounce setting
Bounce was functionally removed in
b2883b213342c912a76329bb8f6c179ea3451ae5 during the transition from Xft
to Cairo without any mention. There is no use to keeping it in the example dunstrc
and storing the value in the code,

This commit will probably be reversed if and when bounce is
re-implemented.
2017-07-03 15:36:08 +03:00
Nikos Tsipinakis
5e2c781cba Move frame settings to the global section
There is no reason for the frame settings to have their own section
since it's not an area that will be expanded upon. Move them to the
global section to be consistent.
2017-07-01 11:56:15 +03:00
Reto Schnyder
d9977cbb41 Handle clicks on release instead of press
This prevents the release event from going to the window behind if the
click closes the notification.
2017-06-29 20:04:14 +02:00
Reto Schnyder
c8e6f317ab Move url prefix removal to open_browser
This way, it also applies to middle clicks.
Incidentally, it seems this fixed a crash when opening <a href> urls.
2017-06-29 19:59:50 +02:00
Reto Schnyder
e04bfe0a58 Allow middle click on notification to invoke action
A middle click on an notification with a single or default action will
invoke it. If there are multiple actions and no default, the context
menu is opened. If there are no actions, proceed similarly with URLs.
2017-06-29 19:38:54 +02:00
Nikos Tsipinakis
aec3533a0b Add frame and experimental to the section list excluded from rules
The frame and experimental sections are currently used for some settings
related to frame colour and experimental features respectively and as
such should not be parsed as rules.
2017-06-27 10:59:05 +03:00
Nikos Tsipinakis
2df3c2291d Add identically named command line flags for all settings
Make every setting be overridable from the command line using
-setting_name. Previously, some settings had shortened command line
flags (e.g. -fn instead of -font) which made the command line arguments
confusing.
2017-06-27 10:46:12 +03:00
Nikos Tsipinakis
ce28250109 Merge pull request #315 from Tadly/master
added body-hyperlinks to capabilities as it is supported
2017-06-15 06:44:52 +03:00
Nikos Tsipinakis
8b74a756c2 Redraw the window after an expose event
Expose events, according to the X11 documentation, signify when the
contents of a window region have been lost but until now we have been
ignoring this event for unknown reasons.

Handle this event by redrawing the window entirely. While this is not a
perfect solution, the optimal one would be to only redraw the
region that was lost, it's simpler to implement currently and better
than losing the contents of the window entirely.
2017-05-04 17:54:06 +03:00
Nikos Tsipinakis
56dfc25baf Add warning if RandR initialization fails
Since currently the multimonitor extension support is a compile-time
argument, there is not much we can do to recover from not being able to
initialize RandR other than print an error and exit.
2017-05-04 17:53:01 +03:00
Nikos Tsipinakis
ce623af5ae Remove unused verbosity variable 2017-05-04 17:49:31 +03:00
tadly
2587173048 added body-hyperlinks to capabilities as it is supported 2017-04-05 16:44:04 +02:00
Nikos Tsipinakis
03c82c22e3 Fix uninitialized class name in dpi handling
Make the class in the XrmGetResource call be the same as the resource
name we are trying to retrieve, "Xft.dpi". Nowhere in the documentation
it is mentioned that the class name can be NULL so it is better to be
cautious and set it to a value that is unlikely to affect anything.
2017-04-02 19:41:36 +03:00
Nikos Tsipinakis
43b4d4bb41 Add per_monitor_dpi experimental setting
Calculating the screen dpi on a per-monitor basis can cause
inconsistencies if multiple monitors with slightly different dpis are
used and in some cases it might not be the expected behaviour.

As such, the per-monitor dpi calculation was changed from a default
fallback to an opt in experimental feature and the default value of 96
will be used for the dpi if Xft.dpi is not set.

In the future, depending on how we decide to continue, we can either
move this setting in the global configuration section and fall back to
the X11 display dpi as the default or simply always use the per-monitor
dpi calculation. But to preserve backwards compatibility, this decision
can wait until the next major release.
2017-04-02 18:27:12 +03:00
Nikos Tsipinakis
52600cdfb0 Refactor monitor handling to keep track of all screens
Previously, we were getting screen info every time we tried to move the
window. To improve the situation, information about the available
screens is initialised once when dunst starts and further behaviour
depends on the compile-time options used.

If Xrandr is enabled, screen information is updated when an
XRRScreenChangeNotify event is received, meaning only when the screen
layout changes.

If Xinerama is enabled, screen information is only updated on startup.
This behaviour might be changed later.

If none are enabled, then dunst assumes only one screen and ignores all
multi-monitor options.
2017-04-02 18:27:12 +03:00
Nikos Tsipinakis
0a6b105f4a Move screen related code into a new file
Since we are adding Xrandr support to allow for automatic dpi detection,
split screen handling code into a new file as part of the effort to
simplify x.c
2017-04-02 18:27:12 +03:00
Nikos Tsipinakis
ebea092ddd Move x.{c,h} to a different subdirectory
x.c has grown into an unmaintainable blob. Moving it in its own
subdirectory is the first step to splitting it into submodules each of
which will have a well defined job so that a lot of the code can be
abstracted to improve readability and make it much easier to maintain.

This process will be done one small part at a time only when we need to
change significantly change a part of the file, there is no need to
break what already works.
2017-04-02 18:27:12 +03:00
Eizen
4dd628ccf4 Add auto-detect dpi method
If Xft.dpi value is not available, auto-detect value based on monitor using randr provided sizes.
Disable Xinerama and enable randr by default.
Also update dpi everytime the monitor changes.
2017-04-02 18:27:12 +03:00
Eizen
cc3a08c1db Add DPI detection method
Use Xft.dpi if available
2017-04-02 18:27:12 +03:00
Nikos Tsipinakis
a6046586a3 Fix minor memory leak
When checking for the markup value in rules, an empty string was
specified as the default value so it can easily be checked if the actual
config value was empty or not. While that string got strdup'ed in the
ini_get_string call, it was only freed if the length > 0, effectively
leaking a tiny amount of memory.

Change that behaviour to use a NULL check instead to avoid leaking
memory.
2017-04-01 22:50:40 +03:00
Luke Shumaker
1f77b28691 markup.c: markup_unquote(): Unquote things in the correct order
Because "&" is not the last character to be unescaped, it is possible that
the lines for "<" and ">" expand some things they shouldn't.

For example, "&amp;lt;" should become "&lt;", but instead it becomes ">".
While this is unlikely to appear naturally in a notification, it is wrong.
2017-03-13 16:40:28 -04:00
Luke Shumaker
18c4b4bf7a markup.c: Tidy, expand comments
This turns a hard-to-understand nested if{} chain into a simple switch
statement, and pulls some code out in to utility functions.

This is strictly a code-organization change, and should contain no
functional changes.
2017-03-13 16:40:28 -04:00
Luke Shumaker
0c84e53afb Move markup handling into markup.{c,h}
This is strictly a code-organization change, and should contain no
functional changes.
2017-03-09 11:32:06 -05: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
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