Recent

Author Topic: Grab DBus Notifications  (Read 463 times)

McClane

  • New Member
  • *
  • Posts: 35
Grab DBus Notifications
« on: January 13, 2021, 08:58:53 pm »
Hi, I'm new to DBus and I wanted to learn a little.
I want to make a loop and get all notifications, especially from Rhythmbox (linux audio player), and from what I've been reading, I really don't know how to achieve it.
A little help would be appreciated.
Thanks!

MarkMLl

  • Hero Member
  • *****
  • Posts: 2050
Re: Grab DBus Notifications
« Reply #1 on: January 13, 2021, 09:41:10 pm »
I've looked at it half-heartedly a number of times but have never been able to work out what the "library de jour" was or what IPC mechanism the low-level implementation used. I've used netlink for udev hotplug messages and found it rather a no-brainer, but suspect that the two have very little in common.

I'd suggest working out what flavour of D-Bus your system uses, and investigating libdbus or whatever. /If/ it uses unix domain sockets, I suspect the major problem will be working out how to tell the daemon responsible for distributing messages that you want some, since it's not generally possible for multiple processes to listen on the same socket (they're very similar to UDP).

MarkMLl
Turbo Pascal v1 on CCP/M-86, multitasking with LAN and graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.

McClane

  • New Member
  • *
  • Posts: 35
Re: Grab DBus Notifications
« Reply #2 on: January 13, 2021, 10:02:29 pm »
I'm trying to adapt the examples on the wiki (https://wiki.lazarus.freepascal.org/FPC_and_DBus) but I don't understand them and I want to adapt them to get rhythmbox notifications.
The properties example is not working :S
« Last Edit: January 13, 2021, 10:05:22 pm by McClane »

MarkMLl

  • Hero Member
  • *****
  • Posts: 2050
Re: Grab DBus Notifications
« Reply #3 on: January 13, 2021, 10:16:47 pm »
I didn't write that and would much rather not get too deeply into it right now since it's a long way from what I'm currently doing... doesn't work /how/? What distro are you using? What IPC mechanism does that distro use for its D-Bus implementation?

MarkMLl
Turbo Pascal v1 on CCP/M-86, multitasking with LAN and graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.

McClane

  • New Member
  • *
  • Posts: 35
Re: Grab DBus Notifications
« Reply #4 on: January 13, 2021, 10:29:47 pm »
I use Peppermint 10 (kernel Linux 5.0.0-36-generic i686) based on Ubuntu Bionic.
I don't know what IPC, sorry.

MarkMLl

  • Hero Member
  • *****
  • Posts: 2050
Re: Grab DBus Notifications
« Reply #5 on: January 13, 2021, 11:00:22 pm »
I use Peppermint 10 (kernel Linux 5.0.0-36-generic i686) based on Ubuntu Bionic.
I don't know what IPC, sorry.

So that probably means it's ultimately Debian-based. Doesn't work /how/? Does it compile? What goes wrong?

MarkMLl
Turbo Pascal v1 on CCP/M-86, multitasking with LAN and graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.

McClane

  • New Member
  • *
  • Posts: 35
Re: Grab DBus Notifications
« Reply #6 on: January 14, 2021, 12:00:20 am »
It works now with this example
Code: Pascal  [Select][+][-]
  1. msg := dbus_message_new_method_call('org.freedesktop.Avahi', '/', 'org.freedesktop.Avahi.Server', 'GetNetworkInterfaceNameByIndex');
but I can't adapt it to org.gnome.Rhythmbox3

MarkMLl

  • Hero Member
  • *****
  • Posts: 2050
Re: Grab DBus Notifications
« Reply #7 on: January 14, 2021, 09:49:55 am »
Make sure you put a note on the wiki page.

MarkMLl
Turbo Pascal v1 on CCP/M-86, multitasking with LAN and graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.

sstvmaster

  • Full Member
  • ***
  • Posts: 210
Windows 10 (64 bit)
Lazarus: 2.0.10 / Trunk x32

 

TinyPortal © 2005-2018