[Gambas-user] Balloons, everywhere but when I don't want them.
Tobias Boege
taboege at ...626...
Fri Aug 18 16:15:35 CEST 2017
On Fri, 18 Aug 2017, Tony Morehen wrote:
> Gambas can talk to the notifications daemon via Dbus. I use this code:
>
> Private NotifyInterface As String = "org.freedesktop.Notifications"
> Private NotifyApp As String = "session://" & NotifyInterface
> Private NotifyPath As String = "/" & Replace(NotifyInterface, ".", "/")
>
> 'does the daemon support icon, body, button to click etc
> Dim sArray As String[] = Dbus[NotifyApp][NotifyPath,
> NotifyInterface].GetCapabilities()
> 'popup (the hintsCollection is an empty collection, iDuration = -1, use
> default)
> notifyID = Dbus[NotifyApp][NotifyPath,
> NotifyInterface].Notify(AppName, notifyID, IconPath,SummaryText, BodyText,
> [TextToSignal, ButtonText], hintsCollection, iDuration)
> 'setup dbussignal to get popup closed and and buttonpressed notifications
>
> Private NotifySignal as New DbusSignal(Dbus.Session,NotifyInterface, True)
> As "NotifyDbusSignal"
> 'signal handler
> Public Sub NotifyDbusSignal_Signal(Signal As String, Arguments As Variant[])
> Select Case Signal
> Case "NotificationClosed"
> Case "ActionInvoked"
> 'Arguments[0] contains TextToSignal from above
> End Select
> End
>
I just checked the code and this is exactly what libnotify does.
--
"There's an old saying: Don't change anything... ever!" -- Mr. Monk
More information about the User
mailing list