Create a gist now

Instantly share code, notes, and snippets.

Embed
What would you like to do?
AppleScript to open Steam in 'big picture' mode. If steam is already running it convert to 'big picture' mode. If a steam game is running in the foreground then nothing should happen. Relies on `pgrep` which comes along with 10.8+.
on isRunningAndSteam(theProcess)
try
set result to do shell script "
if grep -q \"\\-steam\" <<< `/bin/ps -xo command -p \"\\`/usr/bin/pgrep " & theProcess & "\\`\"`; then
echo true
else
echo false
fi"
return result as boolean
end try
end isRunningAndSteam
-- e.g. isRunningAndSteam("hl2_osx")
tell application "System Events"
set currentApp to name of application processes whose frontmost is true
end tell
if not isRunningAndSteam(currentApp) then
do shell script "open /Applications/Steam.app --args -start steam://open/bigpicture"
end if
@ghost

This comment has been minimized.

Show comment
Hide comment
@ghost

ghost Nov 13, 2015

Hi rjocoleman, I have a question
Is there a event on the steam process when you close big picture mode?

I'm looking for a way to manage the big picture status and running scripts on open and close events.

Well I am looking forward to your reply, thanks.

ghost commented Nov 13, 2015

Hi rjocoleman, I have a question
Is there a event on the steam process when you close big picture mode?

I'm looking for a way to manage the big picture status and running scripts on open and close events.

Well I am looking forward to your reply, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment