You are not logged in.

#1 2012-09-12 11:30:30

nierro
Member
From: Milan, Italy
Registered: 2011-09-02
Posts: 798

[SOLVED] Help systemd-sleep script!

Hi!
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

Journalctl returns:

Sep 11 12:37:10 arch systemd-sleep[5100]: Suspending system...
Sep 11 12:37:15 arch systemd-sleep[5100]: System resumed.
Sep 11 12:37:15 arch systemd-sleep[5100]: 5087 4900
Sep 11 12:37:15 arch systemd-sleep[5100]: No existing libpurple instance detected.
Sep 11 12:37:15 arch systemd-sleep[5100]: /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!
Thank you!

Last edited by nierro (2012-09-12 13:40:18)

Offline

#2 2012-09-12 12:45:36

lucke
Member
From: Poland
Registered: 2004-11-30
Posts: 4,018

Re: [SOLVED] Help systemd-sleep script!

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"

in pm-utils.

Offline

#3 2012-09-12 13:07:52

nierro
Member
From: Milan, Italy
Registered: 2011-09-02
Posts: 798

Re: [SOLVED] Help systemd-sleep script!

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 smile

Offline

#4 2012-09-12 13:25:06

lucke
Member
From: Poland
Registered: 2004-11-30
Posts: 4,018

Re: [SOLVED] Help systemd-sleep script!

You have to create the file yourself, by adding

echo $DBUS_SESSION_BUS_ADDRESS > ~/.dbus_session

to your autostart.

Offline

#5 2012-09-12 13:40:06

nierro
Member
From: Milan, Italy
Registered: 2011-09-02
Posts: 798

Re: [SOLVED] Help systemd-sleep script!

And it works.
Thank you very much!
It solved!

Offline

Board footer

Powered by FluxBB