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+.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.