I'm trying to make a script that put my pidgin state on offline, before suspending/hibernating, then available, after resume.
I have purple-remote installed, so i was guessing something like this *should* work:
#!/bin/bash # if(pidof pidgin) then case $1 in pre) su federico -c "purple-remote setstatus?status=offline" ;; post) su federico -c "purple-remote setstatus?status=available" ;; esac fi
Sep 11 12:37:10 arch systemd-sleep: Suspending system... Sep 11 12:37:15 arch systemd-sleep: System resumed. Sep 11 12:37:15 arch systemd-sleep: 5087 4900 Sep 11 12:37:15 arch systemd-sleep: No existing libpurple instance detected. Sep 11 12:37:15 arch systemd-sleep: /usr/lib/systemd/system-sleep/10pidgin exited with exit status 1.
First of all, i noticed that pidof returns two values when called by systemd sleep, while indeed during my session it returns only one:
pidof pidgin 4900
Last, what does "No existing libpurple instance detected" mean?
Any help will be appreciated!
Last edited by nierro (2012-09-12 13:40:18)
purple-remote uses dbus. You probably will see DBUS_SESSION_BUS_ADDRESS listed in "env" in your terminal and won't see it in a virtual console. I was getting around it by writing the value of DBUS_SESSION_BUS_ADDRESS to a file on KDE's start (its value is different on each KDE's start) and then executing
DBUS_SESSION_BUS_ADDRESS=`cat /home/lucke/.dbus_session` su lucke -c "qdbus org.kde.amarok /Player org.freedesktop.MediaPlayer.Stop"
Tried, but it seems i have no .dbus-session in my home. I have a .dbus/session-bus/ and there two files with same name except for the end: -0 and -1. What is the right one?
Any idea? Thank you very much
You have to create the file yourself, by adding
echo $DBUS_SESSION_BUS_ADDRESS > ~/.dbus_session
to your autostart.
And it works.
Thank you very much!