You are not logged in.

#1 2011-01-26 15:03:42

xCrucialDudex
Member
Registered: 2007-08-19
Posts: 144

Run X apps from pm-utils resume hook

So, I need to run 3 X apps from pm-utils resume hook.

I run X as a regular user and my resume hook /etc/pm/sleep.d/40-systrayapps looks like this:

#!/bin/bash
case $1 in
    hibernate)
        ;;
    suspend)
    killall transmission-gtk
    sleep 1
    pkill banshee-1
    sleep 1
    pkill miro
        ;;
    thaw)
        ;;
    resume)
    sleep 10
    transmission-gtk
    sleep 2
    banshee-1 --redirect-log --play-enqueued %U
    sleep 2
    miro
        ;;
    *)
        ;;
esac

The problem is that this hook script is run as root and it has no way of telling that those 3 X apps need to be run in a regular user's X session.

Now, I've tried just about everything I could find on google. You name it, I tried it.

xhost +
xhost +localhost
xhost local:root

xauth merge /home/REGULARUSER/.Xauthority
and combinations with
env DISPLAY=:0 XAUTHORITY=/home/REGULARUSER/.Xauthority miro (for example)

exort DISPLAY=:0; export XAUTHORITY=/home/REGULARUSER/.Xauthority

xauth extract - $DISPLAY

ln -s /home/REGULARUSER/.Xauthority /root/.Xauthority

dynamically detecting X pid and extracting display and xauthority data

all these returend "cannot open display message".

I'm officially baffled and utilized every resource I have including #archlinux@irc.freenode.net

If you have any other ideas how to run X apps after resume in any other way let me know, please.

Offline

#2 2011-01-26 15:05:39

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

Re: Run X apps from pm-utils resume hook

That's what I do:

su lucke - -c "DISPLAY=:0 kmix"

Last edited by lucke (2011-01-26 15:06:32)

Offline

#3 2011-01-26 15:15:41

xCrucialDudex
Member
Registered: 2007-08-19
Posts: 144

Re: Run X apps from pm-utils resume hook

that helps but just a little, miro returned this:

Gconf error.
Failed to contact configuration server; some possible causes are that you need to enable TCP/IP networking for ORBit, or you have stale NFS locks due to a system crash. See http://projects.gnome.org/gconf/ for information. (Details -  1: Failed to get connection to session: Command line `dbus-launch --autolaunch=d96a4237e50e61d8a9985a3c4b81586f --binary-syntax --close-stderr' exited with non-zero exit status 1: No protocol specified\nAutolaunch error: X11 initialization failed.\n)

Offline

#4 2011-01-26 15:35:41

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

Re: Run X apps from pm-utils resume hook

I don't know about gnome, but I had to do some magic if i wanted to stop amarok's playback. On suspend/hibernation I did

DBUS_SESSION_BUS_ADDRESS=`cat /home/lucke/.dbus_session` su lucke -c "qdbus org.kde.amarok /Player org.freedesktop.MediaPlayer.Stop"

- I put a script saving DBUS_SESSION_BUS_ADDRESS in /home/lucke/.dbus_session on kde's start. So you might have to do similar magic with setting the proper environment variables to satisfy gconf or whatever miro wants.

Offline

Board footer

Powered by FluxBB