Results 1 to 4 of 4

Thread: dbus-send question: What's wrong with this command?

  1. #1
    Join Date
    Nov 2007
    Location
    Wisconsin
    Beans
    1,139

    dbus-send question: What's wrong with this command?

    I'm teaching myself how to use DBus. The following python program works great to create a test notification on Xubuntu 8.04...but the shell command to do exactly the same thing using exactly the same DBus method doesn't work. What am I doing wrong with the shell command?

    (Yeah, I know there are other ways to do this. The point is that I want to master the dbus-send command)
    Code:
    # THIS ONE WORKS
    #!/usr/bin/env python
    """This is a python 2.5 script that creates a notification using dbus."""
    import dbus
    item = ('org.freedesktop.Notifications')
    path = ('/org/freedesktop/Notifications')
    interface = ('org.freedesktop.Notifications')
    
    icon = ''
    array = ''
    hint = ''
    time = 10000   # Use seconds x 1000
    app_name = ('Test Application')
    title = ('NOTIFICATION TEST')
    body = ('This is a test of the notification system via DBus.')
    
    bus = dbus.SessionBus()
    notif = bus.get_object(item, path)
    notify = dbus.Interface(notif, interface)
    notify.Notify(app_name, 0, icon, title, body, array, hint, time)
    Code:
    # THIS ONE FAILS
    dbus-send --session --dest=org.freedesktop.Notifications \
    --type=method_call --reply-timeout=10000 /org/freedesktop/Notifications \
    org.freedesktop.Notifications.Notify string:'Test Application' uint32:0 \
    string: string:'NOTIFICATION TEST' \
    string:'This is a test of the notification system via DBus.' \
    array:string: dict:string: int32:10000

  2. #2
    Join Date
    Oct 2009
    Beans
    1

    Exclamation Re: dbus-send question: What's wrong with this command?

    Hi Cheesehead,

    you used empty containers, but dbus-send manpage says:

    Code:
    D-Bus  supports more types than these, but dbus-send currently does not.
    Also, dbus-send does not permit empty containers or nested containers 
    (e.g. arrays of variants).
    parvulos

  3. #3
    Join Date
    May 2006
    Beans
    180
    Distro
    Xubuntu 8.04 Hardy Heron

    Re: dbus-send question: What's wrong with this command?

    Quote Originally Posted by parvulos View Post
    Hi Cheesehead,

    you used empty containers,
    Same with 0 length strings, can this API be used w/ dbus-send ?


    Code:
    dbus-send --session --type=method_call --reply-timeout=10000 \
      --dest=org.freedesktop.Notifications \
      /org/freedesktop/Notifications  org.freedesktop.Notifications.Notify \
      string:"app_name" \
      uint32:0 \
      string:'app_icon' \
      string:"summary" \
      string:"body" \
      array:string:"" \
      dict:string:string:"",""\
      int32:10000
    # http://rzr.online.fr/q/apt # test my deb's please
    # http://rzr.online.fr/q/ubuntu # contribs docs etc
    # http://rzr.online.fr/q/unicorn # works for me
    # http://go.cur.lv/files# files to be shared or email me

  4. #4
    Join Date
    Nov 2009
    Beans
    2

    Re: dbus-send question: What's wrong with this command?

    Hello!

    I like your script in the first post very much.

    Only that it doesn't solve my problem, which is to have a script that doesn't run in user context (i.e. started by anacron) send messages to my screen.

    Do you happen to know if it's possible to include the --system parameter an if that has the desired effect?

    Thanks in advance, Karsten

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •