You are not logged in.
#!/bin/bash
XPID=$(pgrep -f "Xorg")
if [ ! -z "$XPID" ] ; then
export XAUTHORITY=$(sed 's/\x00/ /g ; s,.*-auth ,, ; s, .*,,' /proc/$XPID/cmdline)
export DISPLAY=$(sed 's/\x00/ /g ; s,.* \(:[0-9]\) .*,\1,' /proc/$XPID/cmdline)
DBUS_SESSION_BUS_ADDRESS=`cat /home/$USER/.dbus_session` gcalctool
fi
For the sake of simplicity I do not show how USER and .dbus_session are created. Let's just assume we always can know them. The above code when run from TTY root session results in this:
g_dbus_connection_real_closed: Remote peer vanished with error: Underlying GIOStream returned 0 bytes on an async read (g-io-error-quark, 0). Exiting.
I attempt to run a GTK application (say banshee/transmisison) via the script which is a resume hook for pm-utils. The script is run as root user, but I need to start banshee for my normal user.
I've no idea what that dbus-related error means and how to fix it. Any ideas?
Perhaps a simpler solution?
Last edited by xCrucialDudex (2012-02-04 21:27:19)
Offline