Skip to content

Instantly share code, notes, and snippets.

@rjocoleman
Last active January 2, 2016 13:49
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save rjocoleman/8312639 to your computer and use it in GitHub Desktop.
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
Copy link

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