#!/bin/sh

# sometimes XAUTHORITY is empty
authfile=$XAUTHORITY
if [ "$authfile" == "" ]; then
    authfile=`xauth info | head -n 1 | grep -o '/.*'`
fi

# don't want to lose e.g. SUDO_USER variable
[ `id -u` -ne 0 ] && pkexec=`type -p pkexec`

$pkexec env DISPLAY="$DISPLAY" XAUTHORITY="$authfile" /usr/bin/python "/usr/lib/howdy-gtk/init.py" "$@"