#! /bin/sh

handle()
{
    echo "SIGINT detected. continue."
}

# start dbus session and get env:
#
# DBUS_SESSION_BUS_ADDRESS='unix:path=/tmp/dbus-...
# export DBUS_SESSION_BUS_ADDRESS;
# DBUS_SESSION_BUS_PID=3598;


# shellcheck disable=SC1091
. /etc/profile

eval "$(dbus-launch --auto-syntax)"

# trap the sigint
trap 'handle' INT
"$@"

# stop the
kill -9 "$DBUS_SESSION_BUS_PID"
echo "Session closed"