-
Notifications
You must be signed in to change notification settings - Fork 15
Linux: add reply field support #226
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
Conversation
This adds support for the reply field on Linux, using the `inline-reply` capability. It might not exist everywhere but seems to be standard as it doesn't have a `x-vendor` prefix.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #226 +/- ##
==========================================
+ Coverage 85.06% 85.23% +0.17%
==========================================
Files 10 10
Lines 951 962 +11
==========================================
+ Hits 809 820 +11
Misses 142 142
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
samschott
left a comment
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.
Thanks for the contribution! It looks like inline replies are not part of the spec at https://specifications.freedesktop.org/notification-spec/latest/protocol.html#command-get-capabilities, even though the capability is not prefixed with "x-vendor". Do you know on which desktop environments you expect this to be supported?
Two requests:
Yes, I will do both of those things as well. For the change log entry, shall I bump the version? |
Yes! 6.2.0 would be appropriate since its a "new" feature for the dbus backend. |
Forgot to add that part in my other reply, oops. After looking a bit more, it seems like
If you still wish to merge that PR, I'd be happy to still bring the requested changed. |
|
Given that KDE is a sufficiently popular desktop environment, I'd be happy to proceed with this PR. |
Since "inline-reply" is non-standard either, I'd be happy also include button_text support for KDE: The approach for this lib is to support features where possible and expose notification server capabilities through the API. An app should generally not rely on notifications for key interaction patterns since users may disable them or limit their capabilities on a per-app basis, so a "your milage will vary" approach sounds good to me. |
Added check to ignore reply field if the notification server doesn't support `inline-reply`, as well as adding support for `x-kde-reply-submit-button-text`
samschott
left a comment
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.
Thanks a lot! Only a few minor requests for changes.
| hints_v: dict[str, Variant] = dict() | ||
| if notification.reply_field and self.supports_inline_reply: | ||
| actions += [INLINE_REPLY_ACTION_KEY, notification.reply_field.title] | ||
| hints_v["x-kde-reply-submit-button-text"] = Variant( |
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.
nit: Could you move "x-kde-reply-submit-button-text" also to a constant?
| actions += [button.identifier, button.title] | ||
|
|
||
| hints_v: dict[str, Variant] = dict() | ||
| if notification.reply_field and self.supports_inline_reply: |
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.
| if notification.reply_field and self.supports_inline_reply: | |
| if notification.reply_field and Capability.REPLY_FIELD in await self.get_capabilities(): |
CHANGES.md
Outdated
| @@ -1,3 +1,10 @@ | |||
| # v6.2.0 | |||
|
|
|||
| ## Added : | |||
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.
| ## Added : | |
| ## Added: |
|
|
||
| @pytest.mark.asyncio | ||
| async def test_replied_fallback_handler_called(notifier: DesktopNotifier) -> None: | ||
| await check_supported(notifier, Capability.REPLY_FIELD) |
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.
Darn, it looks like this check is also required for older MacOS versions which now have failing tests.
For now, I'd recommend adding this back again, and accepting that we have a bit less coverage on Linux. I can look later into setting up a notification daemon with inline-reply support on GitHub Actions.
This adds support for the reply field on Linux, using the
inline-replycapability. It might not exist everywhere but seems to be standard as it doesn't have ax-vendorprefix.Support for the

button_textfield could be achieved, but it doesn't seem to be standardized (yet?), so unsure if this is in the scope of this lib.