Recent

Author Topic: Grab DBus Notifications  (Read 1050 times)

McClane

  • New Member
  • *
  • Posts: 44
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: 6682
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
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

McClane

  • New Member
  • *
  • Posts: 44
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: 6682
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
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

McClane

  • New Member
  • *
  • Posts: 44
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: 6682
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
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

McClane

  • New Member
  • *
  • Posts: 44
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: 6682
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
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

sstvmaster

  • Sr. Member
  • ****
  • Posts: 299
greetings Maik

Windows 10,
- Lazarus 2.2.6 (stable) + fpc 3.2.2 (stable)
- Lazarus 2.2.7 (fixes) + fpc 3.3.1 (main/trunk)

 

TinyPortal © 2005-2018