#!/bin/bash
umask 0
for try in 1 2 3; do
	if ! pidof steam; then break; fi
	if [ $try -lt 3 ]; then
		zenity --info --text "close steam first"
	else
		zenity --timeout 5 --info --text "steam is still running, killing it" &
		q killall steam
		sleep 1
		q killall -9 steam
	fi
done
#( while pidof steam; do kill -QUIT $(pidof steam); sleep 1; done )
zenity --timeout 5 --info --text "starting steam-wine, please wait" &
steam-share
#sudo steam-share-full
A=$1 ; shift
A=${A/steamwine:/steam:}
#export WINED3DFOGOFF=1  # for Risk of Rain
exec env WINEPREFIX="$HOME/.wine" wine "$HOME/.wine/drive_c/Program Files/Steam/Steam.exe" -no-dwrite "$A" "$@"
#exec env WINEPREFIX="$HOME/.wine" wine C:\\windows\\command\\start.exe /Unix "$HOME/.wine/dosdevices/c:/users/Public/Desktop/Steam.lnk" -no-dwrite "$A" "$@"
