You are not logged in.

#1 2012-05-30 16:03:56

thall
Member
Registered: 2012-05-30
Posts: 12

Problem with acpi handler and dbus

Hi,

I'm trying to bind acpi handler cd/next , prev, play to regulate Spotify through DBus, but its exit with status code 1.

So part of my handler.sh, it matches cd/next since SPOTIFY NEXT is logged

cd/next)
  logger "SPOTIFY NEXT"
  su thall -c /home/thall/scripts/spotify_next.sh
  ;;

and spotify_next.sh

#!/bin/sh
dbus-send --print-reply --session --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Next

But if i change to root and try it there it works as expected.

sudo su
[root@archmbp thall]# su thall -c /home/thall/scripts/spotify_next.sh 
method return sender=:1.2 -> dest=:1.5 reply_serial=2

Cant understand whats wrong

Offline

#2 2012-05-30 16:57:33

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,571
Website

Re: Problem with acpi handler and dbus

If this is in X, how do you start X?  Do you have a dbus session running for your user (dbus-launch in htop or system monitors)?


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#3 2012-05-30 17:10:16

thall
Member
Registered: 2012-05-30
Posts: 12

Re: Problem with acpi handler and dbus

Trilby wrote:

If this is in X, how do you start X?  Do you have a dbus session running for your user (dbus-launch in htop or system monitors)?

When I login, through .bash_profile

#Start X11 on login
if [[ -z $DISPLAY ]] && [[ $(tty) = /dev/tty1 ]]; then
  exec startx
fi

and there is a dbus session for the user thall.

[~]$ ps aux | grep dbus-launch
thall     2206  0.0  0.0  20112   584 ?        S    17:09   0:00 dbus-launch --autolaunch 5508d1549453ab7c3b40aae7000002c8 --binary-syntax --close-stderr
root      5549  0.0  0.0  20112   584 pts/2    S    17:14   0:00 dbus-launch --autolaunch 5508d1549453ab7c3b40aae7000002c8 --binary-syntax --close-stderr

Offline

#4 2013-09-28 11:14:47

vicente.845
Member
Registered: 2013-09-28
Posts: 2

Re: Problem with acpi handler and dbus

I had the same problem and I fixed it adding DISPLAY=:0.0 (http://forums.gentoo.org/viewtopic-t-92 … art-0.html)

You can change your handler.sh to
DISPLAY=:0.0 su -c "dbus-send --print-reply --session --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Next" thall

Offline

Board footer

Powered by FluxBB