Closed xfalcox closed 1 year ago
is there a application in Linux that sends these kind of notifications?
When using snc there is a button for the action with type text
That is "snc"?
is there a application in Linux that sends these kind of notifications?
Chrome does.
That is "snc"?
Sorry, meant that when using SwayNotificationCenter and sending a notification that contains an action with the "text" type it will render the notification button, but since there is no input, clicking on it will send the action back with a null value. Just tested it on my machine by subscribing to a website that sends those types of notifications.
Chrome does.
Which website?
Could you run swaync with all messages enabled (G_MESSAGES_DEBUG=all swaync
), receive that notification and paste the output here? The output should be something like this:
** (swaync:181171): DEBUG: 18:18:24.180: notiDaemon.vala:153: Notification:
category: (null)
image_data: false
expire_timeout: -1
replaces_id: 0
desktop_entry: (null)
body: Notification body
app_icon:
action_icons: false
time: 1668446304
hints:
sender-pid: int64 181220
urgency: byte 0x02
applied_id: 1
image_path: (null)
app_name: notify-send
summary: Summary
icon_data: false
resident: false
default_action: (null)
actions:
urgency: Critical
Which website?
For testing you can use https://tests.peter.sh/notification-generator/ and select "Actions = One action (type text with placeholder)" to trigger it as you want with the "Display Notification" button.
If you add a breakpoint to the sw.js file on your Chrome instance DevTools on line 23 and inspect the event
object, you will see that the reply
attribute value is null. That's where the text would be inserted.
Could you run swaync with all messages enabled (G_MESSAGES_DEBUG=all swaync), receive that notification and paste the output here?
Sure, here it is:
** (swaync:94956): DEBUG: 16:31:38.166: notiDaemon.vala:153: Notification:
category: (null)
image_data: false
expire_timeout: -1
replaces_id: 0
desktop_entry: chromium
body: tests.peter.sh
Notification content
app_icon: file:///tmp/.org.chromium.Chromium.IfUXnn
action_icons: false
time: 1668454298
hints:
urgency: uint32 1
desktop-entry: 'chromium'
image_path: data
image-path: data
applied_id: 1
image_path: /tmp/.org.chromium.Chromium.y3MoXf
app_name: Chromium
summary: Notification title
icon_data: false
resident: false
default_action: Name: Activate, Id: default
actions:
Name: Reply, Id: 0
Name: Settings, Id: settings
urgency: Low
Out of curiosity, looks like Telegram desktop (native app) also sends those
** (swaync:94956): DEBUG: 16:33:49.604: notiDaemon.vala:153: Notification:
category: im.received
image_data: true
expire_timeout: -1
replaces_id: 0
desktop_entry: telegramdesktop
body: Falco
app_icon:
action_icons: false
time: 1668454429
hints:
image-data: data
desktop-entry: 'telegramdesktop'
category: 'im.received'
applied_id: 3
image_path: (null)
app_name: Telegram Desktop
summary: delmamonteiro
icon_data: false
resident: false
default_action: (null)
actions:
Name: Mark as read, Id: mail-mark-read
Name: Reply, Id: mail-reply-sender
urgency: Low
Oh. Looks like the actions only show in Chromium and not Firefox. That's why it didn't work for me... There's no specific hints to indicate that it needs a input. Does it work in Gnome / KDE?
My guess is that it's not implemented on Linux browsers due to it not being in the Freedesktop Notification spec
Oh. Looks like the actions only show in Chromium and not Firefox. That's why it didn't work for me...
Yeah, it's still in Firefox backlog per https://bugzilla.mozilla.org/show_bug.cgi?id=1225110
There's no specific hints to indicate that it needs a input. My guess is that it's not implemented on Linux browsers due to it not being in the Freedesktop Notification spec
The hint is the action "type", but looks like that isn't being passed down as NotificationAction on the spec is still just a string and ID :cry:
My guess is that Freedesktop Notification spec will only update when https://github.com/whatwg/notifications/pull/132 is merged so let's see what happens...
I've turned on notifications for that PR so I'll return to this when it gets updated :)
How about native apps like nheko which definitely have inline reply support on KDE? There is a category: im.received
hint but no action detected. Wonder how KDE handles it.
there are actions mentions in nheko's implementation but swaync doesn't seem to pick it up
** (swaync:119054): DEBUG: 00:03:53.332: notiDaemon.vala:153: Notification:
category: im.received
image_data: true
expire_timeout: -1
replaces_id: 0
desktop_entry: nheko
body: noodles : test convo
app_icon:
action_icons: false
time: 1676909033
hints:
image-data: data
sound-name: 'message-new-instant'
desktop-entry: 'nheko'
category: 'im.received'
applied_id: 22
image_path: (null)
app_name: nheko
summary: noodles
icon_data: false
resident: false
default_action: (null)
actions:
urgency: Low
while dunst does detect the actions. There is also an activation action that raise the correct room as well.
Maybe adding inline-reply
to GetCapabilities would make it visible?
https://github.com/ErikReider/SwayNotificationCenter/blob/c264d44c739b9d7f5cfa9389b5089b3888f13e65/src/notiDaemon/notiDaemon.vala#L93-L105
How about native apps like nheko which definitely have inline reply support on KDE? There is a
category: im.received
hint but no action detected. Wonder how KDE handles it.
Do you know where the KDE notification daemon source code is located? Haven't been able to find it. Maybe they're doing something different?
PROGRESS! Adding inline-reply
to GetCapabilities seems to work! :)
category: (null)
image_data: false
expire_timeout: -1
replaces_id: 0
desktop_entry: chromium
body: tests.peter.sh
Notification content
app_icon: file:///tmp/.org.chromium.Chromium.gtfpFo
action_icons: false
time: 1676976678
hints:
x-kde-reply-placeholder-text: 'Placeholder'
urgency: uint32 1
desktop-entry: 'chromium'
image_path: data
image-path: data
applied_id: 3
image_path: /tmp/.org.chromium.Chromium.wyZMU3
app_name: Chromium
summary: Notification title
icon_data: false
resident: false
default_action: Name: Activate, Id: default
actions:
Name: Reply, Id: inline-reply
Name: Settings, Id: settings
urgency: Low
Now what's missing is the documentation / spec for this 3rd party spec...
Edit:
Found some relevant links which might be good to have for future reference:
@xfalcox @slikie See if the #221 PR works for your applications
PROGRESS! Adding inline-reply to GetCapabilities seems to work! :) For some reason I can't replicate this. The action still doesn't seem to get caught. On firefox it doesn't catch anything, while on chrome it parses the placeholder message right but can't edit or reply. With
nheko
I can't see the action as well.category: (null) image_data: false expire_timeout: -1 replaces_id: 0 desktop_entry: chromium body: tests.peter.sh
Notification content app_icon: file:///tmp/.org.chromium.Chromium.FpxP0S action_icons: false time: 1677054974 hints: x-kde-reply-placeholder-text: 'Send message' urgency: uint32 1 desktop-entry: 'chromium' image_path: data image-path: data applied_id: 1 image_path: /tmp/.org.chromium.Chromium.OzEaKr app_name: Chromium summary: Notification title icon_data: false resident: false default_action: Name: Activate, Id: default actions: Name: Settings, Id: settings urgency: Low
For some reason I can't replicate this. The action still doesn't seem to get caught. On firefox it doesn't catch anything, while on chrome it parses the placeholder message right but can't edit or reply. With
nheko
I can't see the action as well.category: (null) image_data: false expire_timeout: -1 replaces_id: 0 desktop_entry: chromium body: tests.peter.sh Notification content app_icon: file:///tmp/.org.chromium.Chromium.FpxP0S action_icons: false time: 1677054974 hints: x-kde-reply-placeholder-text: 'Send message' urgency: uint32 1 desktop-entry: 'chromium' image_path: data image-path: data applied_id: 1 image_path: /tmp/.org.chromium.Chromium.OzEaKr app_name: Chromium summary: Notification title icon_data: false resident: false default_action: Name: Activate, Id: default actions: Name: Settings, Id: settings urgency: Low
With the pr? The "inline-reply" action is removed from the output so that would be why. Firefox isn't working but chromium is. Do you get a text field on your notification?
swaync 0.7.3 (git-1c80c60, branch 'makepkg')
Yes I get a text field with the debug website and on kde_connect fro phone apparently, but I can't type on it or click the reply button. The app nheko
doesn't get it though.
On Feb 22 2023, at 5:02 pm, Erik Reider @.***> wrote:
For some reason I can't replicate this. The action still doesn't seem to get caught. On firefox it doesn't catch anything, while on chrome it parses the placeholder message right but can't edit or reply. With nheko I can't see the action as well. category: (null) image_data: false expire_timeout: -1 replaces_id: 0 desktop_entry: chromium body: tests.peter.sh
Notification content app_icon: file:///tmp/.org.chromium.Chromium.FpxP0S action_icons: false time: 1677054974 hints: x-kde-reply-placeholder-text: 'Send message' urgency: uint32 1 desktop-entry: 'chromium' image_path: data image-path: data applied_id: 1 image_path: /tmp/.org.chromium.Chromium.OzEaKr app_name: Chromium summary: Notification title icon_data: false resident: false default_action: Name: Activate, Id: default actions: Name: Settings, Id: settings urgency: Low With the pr? The "inline-reply" action is removed from the output so that would be why. Firefox isn't working but chromium is. Do you get a text field on your notification? — Reply to this email directly, view it on GitHub (https://github.com/ErikReider/SwayNotificationCenter/issues/179#issuecomment-1439654613), or unsubscribe (https://github.com/notifications/unsubscribe-auth/ADEV7PXMO4HTM7SVHQZMY63WYXI2LANCNFSM6AAAAAAR74UNGU). You are receiving this because you were mentioned.
swaync 0.7.3 (git-1c80c60, branch 'makepkg') Yes I get a text field with the debug website and on kde_connect fro phone apparently, but I can't type on it or click the reply button.
This is a sway limitation that I'll need to work around... It'll work if you open the control center
Ah sorry apparently it works... I successfully replied a message on my phone on kde connect.
Ah sorry apparently it works... I successfully replied a message on my phone on kde connect.
Awesome! Now the remaining todos...
On Windows/Android/ChromeOS, when you send a notification that contains an action of type text, it will allow the user to type some text in a input box and send the action with the typed text as the parameter.
Android:
Windows:
When using snc there is a button for the action with type text, but clicking on it send the notification with a
null
value for the action.This is useful, for example, in chat apps so you can type a quick response without having to open a window of the app.