DBus notify images
Posted
#1
(In Topic #1142)
Guru

I've tried various methods
I've read the docs here Portal API Reference - Flatpak documentation
portal docs said
<COLOR color="#0000FF">icon</COLOR> v
Serialized icon (see g_icon_serialize()).
The portal only accepts serialized GThemedIcon and GBytesIcons.
Both of these have the form (sv).
For themed icons, the string is "themed", and the value is an array of strings containing the icon names.
For bytes icons, the string is "bytes", and the value is a bytestring containing the icon data in png, jpeg or svg form.
For historical reasons, it is also possible to send a simple string for themed icons with a single icon name.
There may be further restrictions on the supported kinds of icons.
Code (gambas)
- cNotification = ["icon": ["themed": s], "title": Title, "body": "\n" & Text & "\n", "priority": $aPriorities[Priority]]
- DBus["session://org.freedesktop.portal.Desktop"]["/org/freedesktop/portal/desktop", "org.freedesktop.portal.Notification"].AddNotification(Application.Id, cNotification)
I've tried as an array
Ive tried as a direct string
looking like i may need extern library function to get g_icon_serialize() and make a proper GIcon
Or to find someone who knows a way to do this :roll:
Posted
Guru

This is it in action..
really need to be able to make images show though.
Currently i have DBMessage.Info() and DBMessage.Question() but want images to enable others like Error.
There's property DBMessage.Wait that if true DBMessage.Question() will wait for selection then return the value
if false then the program can continue and the static DBMessage_Click() event is used. (if not Wait then the message can and will timeout)
The form that will get the DBMessage_Click() event can be set using the DBMessage.AttachTo property otherwise it uses either Application.MainWindow or if not set Windows[0].
There is no way to tell if a notification has timed out so to enable "Wait" i am using a trick that just cancels and resends the notification every 6 seconds.
notifications normally timeout in 7 seconds on my machine so i redo the notification until the user interacts.
Posted
Guru

I was trying my code with the icon name "question" thinking that was a stock icon name.
I was wrong and the stock icon i was looking for was called dialog-question :-\
So it turns out you can add icons by simply giving a icon name., i think the available icon name vary on theme being used.
I found the official list from freedesktop https://specifications.freedesktop.org/icon-naming-spec/latest/ar01s04.html
so for notify with a question image i just need to add ["icon": "dialog-question"] to the collection.
1 guest and 0 members have just viewed this.




