#!/bin/sh
set -e

EXEC="${exec:-$EXEC}"
ABS_BUILDDIR='@ABS_BUILDDIR@'

# gnome-session wants org.gnome.Mutter.DisplayConfig
if ! dbus-send --session --dest=org.freedesktop.DBus \
               --type=method_call --print-reply /org/freedesktop/DBus \
               org.freedesktop.DBus.ListNames \
   | grep -qs '[o]rg\.gnome.Mutter\.DisplayConfig'; then
   helpers/mutter-dbus-stub.py &
fi

# Start up g-s-d, etc.
gnome-session --session=gnome-dummy --disable-acceleration-check &

export GSETTINGS_SCHEMA_DIR="${ABS_BUILDDIR}/data"
export G_MESSAGES_DEBUG=all
${EXEC} "${ABS_BUILDDIR}/src/phosh" $@
