-
-
Notifications
You must be signed in to change notification settings - Fork 467
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
feat: add Linux support for Live Notifications toasts w/ libnotify #5881
Conversation
Could you do this in another PR? This makes the diff way larger than it actually is. You can remove |
ab01d7f
to
b255730
Compare
Hi! Thanks for your initial PR, I just wanted to let you know that the use of |
b255730
to
1289046
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy made some suggestions
the aur version of chatterino will also need to include libnotify as a dep then |
1289046
to
9993be2
Compare
Thanks, happy to provide a PKGBUILD patch but it should just be Missed nixos in the docs so updated. |
@camporter I would prefer if desktop notifications for highlights is not added in this PR - It's too much of a separate feature. I'm currently looking into changing the way highlights are modified (more options means more checkboxes in the current way of doing things, and that gets really unwieldy) If you want to add some way to test desktop notifications easier, feel free to add an additional branch to the |
27d6f18
to
898d901
Compare
898d901
to
5a355b1
Compare
For the container update you could make a PR in https://github.com/Chatterino/docker where you update |
Ah thanks, confused the separate repo with the |
5a355b1
to
c509737
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small nits, otherwise seems good
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we could make our own small notification library (I'd be fine with a submodule here). Implementing this for macOS doesn't seem to be that complicated either (KNotifications impl - ObjectiveC might be the hardest part here). Maybe after EventSub is in a decent state.
src/singletons/Toasts.hpp
Outdated
#elif defined(LIBNOTIFY) | ||
void ensureInitialized(); | ||
void sendLibnotify(const QString &channelName, const QString &channelTitle); | ||
|
||
bool initialized_ = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could ensureInitialized
and initialized_
be defined in a single block? They're the same on Windows and with libnotify. Maybe the send*
functions could be united as well. Something like sendPlatformNotification
? It would include the platform for now (#5914).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably best to leave for follow-up PR, or for whenever notifications are touched again
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left these separate just to avoid getting into too much rework here, but combining them or moving them into a library seems good. The macos notification stuff required signing and other conditions that I didn't wade into. I don't boot windows up very often to test there either 😆
For linux/freebsd, you could also avoid libnotify and use dbus directly, but a bit more involved to do.
c509737
to
589af77
Compare
Looks like you can apply this patch to fix the FreeBSD build, and it also just looks simpler diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 24ddbe7b..05a83ebd 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1065,10 +1065,8 @@ if (UNIX)
if (NOT APPLE AND BUILD_WITH_LIBNOTIFY)
find_package(PkgConfig REQUIRED)
- pkg_check_modules(LIBNOTIFY REQUIRED libnotify)
- include_directories(${LIBRARY_PROJECT} ${LIBNOTIFY_INCLUDE_DIRS})
- target_link_libraries(${LIBRARY_PROJECT} PRIVATE ${LIBNOTIFY_LIBRARIES})
- target_link_directories(${LIBRARY_PROJECT} PRIVATE ${LIBNOTIFY_LIBRARY_DIRS})
+ pkg_check_modules(LIBNOTIFY REQUIRED IMPORTED_TARGET libnotify)
+ target_link_libraries(${LIBRARY_PROJECT} PRIVATE PkgConfig::LIBNOTIFY)
target_compile_definitions(${LIBRARY_PROJECT} PUBLIC CHATTERINO_WITH_LIBNOTIFY)
endif ()
endif () |
589af77
to
a5e29a5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Notifications works for me, valgrind doesn't complain about anything (new) - Thank you!
Add libnotify notification support for channels going live. Would be nice to have notifications for other things as well, but this is just adding an equivalent for wintoast.
Disabled QT keywords to not clash with glib 😞 there's probably a better way to do this.
Fixes #5782
There's a lot of testing that needs to be done and build concerns, so leaving as a draft.