-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added PCRE notification filtering/blocking #364
base: master
Are you sure you want to change the base?
Conversation
Please, what is the reason to not use the Qt's facility for regular expressions and do this std <-> qt translations? |
For the first comment regarding std::string I have no excuse other then it is what I am familiar with. For the second point using QRegularExpression adds yet another external dependency when std::regex is more then sufficient to accomplish the task. |
What additional dependency are you referring to? It is in Qt core, isn't it? |
Yes you would have to add Qt core as a dependency. This is already an argument with sticking with std::regex. Between major versions of Qt you would need to modify the cmake list and refactor the code because the interface for regular expressions changed between Qt versions. For Qt5: ...
find_package(Qt6 REQUIRED COMPONENTS Core5Compat)
target_link_libraries(mytarget PRIVATE Qt6::Core5Compat)
... and for Qt6: ...
find_package(Qt6 REQUIRED COMPONENTS Core)
target_link_libraries(mytarget PRIVATE Qt6::Core)
... Even briefly looking at the docs for QRegExp in Qt5 and QRegularExpression in Qt6 there are significant interface changes between qt5 and qt6. This would add another thing that would need to be majorly refactored and tested between qt versions. I think sticking with the C++ standard libraries wherever possible is prudent. |
Nothing in Qt is an extra dependency, let alone Qt core.
|
Sorry, at this point I am very confused. All of the branches refer to Qt5: lxqt-notificationd/CMakeLists.txt Line 21 in 01699d8
lxqt-notificationd/CMakeLists.txt Line 24 in 01699d8
lxqt-notificationd/CMakeLists.txt Line 25 in 01699d8
|
..and don't compile regexps on each filtering invocation.
You're confusing us. There is no additional dependency needed for using Qt regular expressions -> see the PR for your code. |
layout: Use Qt regular expression facility
Background
This PR adds PCRE message filtering and blocking.
Many applications offer no ability or limited ability to configure notifications.
This is annoying when a particular application is sending too many notifications.
There may be some interesting notifications that an application offers and some
annoying ones with no way to configure fine grain control of this.
Why does this need to exist?
Some applications do not allow you to configure notifications or do not support
granular notification settings. The black list feature does not work as expected
or desired. Some notifications are absolutely incessant where you constantly have to click them away or interact with them. This PR offers a simple and powerful solution to filter dbus notifications based off of PCREs; this feature could be rolled into the black list if desired.
This PR offers a simple and powerful way to filter/block messages with a PCRE
no matter how the notifications are generated.
Messages can be filtered on:
application
,body
orsummary
by settingeither
application_pcre_filter
,body_pcre_filter
and/orsummary_pcre_filter
in the
lxqt/notifications.conf
.If the application string is captured by the PCRE set by
application_pcre_filter
then the notification will not be shown, same goes for the body and summary.
View the readme for more details on configuring PCRE filters.
Changes
application_pcre_filter
,body_pcre_filter
, andsummary_pcre_filter
src/CMakeLists.txt
for the lxqt-notificationdtarget.
PCRE containing a syntax error then lxqt-notificationd should simply ignore it
instead of crashing.
boolean NotificationLayout::filter(std::string string, std::string pcre)