#!/bin/bash

export PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:$PATH

cmd_exec=$(echo "$1" | cut -d " " -f 1)
which "$cmd_exec" 1>/dev/null
if [ $? -eq 1 ]; then
	notify-send "Failed to execute \"$1\"" "Command \"$cmd_exec\" cannot be found. Please report this bug to team@parrotsec.org" -i "security-low"
	exit
else
	notify-send "ParrotSec" "Starting $*"
	pkexec env DISPLAY="$DISPLAY" XAUTHORITY="$XAUTHORITY" $*
fi
