dunst-project / dunst

Lightweight and customizable notification daemon
https://dunst-project.org
Other
4.42k stars 338 forks source link

excluding regex does not work in dunstrc rules #1260

Closed BadgerAAV closed 5 months ago

BadgerAAV commented 5 months ago

Issue description

I use batsignal to notify of a low battery on my laptop. Dunstrc has two sections - for all notifications excluding the batsignal application and for the batsignal application itself. With regex excluding only the batsignal application, dust writes in the log WARNING: Invalid preceding regular expression: "^(?!batsignal).*$" and does not process my script from "all" section. If I remove the rule, then when receiving a notification from batsignal, both my scripts from the All and batsignal sections are processed, respectively.

Installation info

Addition to the standard dunstrc ```ini [global] enable_posix_regex = true [all] appname = ^(?!batsignal).*$ script = ~/.config/dunst/bell_sound.sh [batsignal] appname = batsignal script = ~/.config/dunst/power_sound_alert.sh ```

Is it possible to use exclusionary expressions in the rules? I want to set the rules for a separate script for one application and one separate script for all the others.

fwsmit commented 5 months ago

Moving to discussions to discuss possible regexes. Note that dunst uses the following line to compile the regex: regcomp(&regex, pattern, REG_NEWLINE | REG_EXTENDED | REG_NOSUB);

You can take a look at man regcomp and POSIX regex syntax