Did a little digging and didn’t find a way to get plex to start to predefined display & fullscreen regardless of where it was last closed. (other than overwriting stuff in guisettings.xml by script before launching plex which I didn’t want to do…) So I wrote a little applescript which gets run when I hit a button on cordless ‘multimedia’ keyboard which I use in my home theatre room (my mac ain’t in the same room so it just sucked having to run back to the mac to move the plex window to secondary display in case I had done something with plex on the primary display the last time it was running).
It starts plex, checks if it is on your primary display, and if it’s there, checks if it is fullscreen, hits cmd-F to if it was, and moves & full screens it on secondary display that is right of your regular display and your regular display width is 1680. Easy to modify to work with any display arrangement.
The full screen check by y coordinate works on the display where you have menu bar, as the highest you can move window to is 22 This wont work in case you move the plex in windowed mode to very top of display which does not have menu bar (works otherwise, but won’t full screen it). Does someone know a better way to check it it is fullscreen or not? I couldn’t get ‘bounds’ of Plex window for some reason, so cannot compare display width/height to plex window dimensions.
tell application "Plex" to activate<br />
tell application "System Events" to tell process "Plex"<br />
tell window 1<br />
set {x, y} to get position<br />
end tell<br />
set moved_by_script to false<br />
if x < 1680 then<br />
if y = 0 then<br />
key code 3 using command down<br />
set moved_by_script to true<br />
end if<br />
tell window 1 to set position to {x + 1680, y}<br />
end if<br />
if y > 0 or moved_by_script then<br />
key code 3 using command down<br />
end if<br />
end tell
tell application "System Events" to tell process "Plex" to tell window 1<br />
set {x0, y0} to get position<br />
set {x1, y1} to size<br />
end tell<br />
return {x0, y0, x0 + x1, y0 + y1}
btw the display dimensions are in /Library/Preferences/com.apple.windowserver.plist if you've got multiple displays.
Can this be modified to start Plex or focus it if it's already running, then enable fullscreen on a single monitor . I want to use controllermate to run the applescript when I press Watch Plex on my remote.
This script works but if plex was already fullscreen it goes windowed then fullscreen again. I don't know enough about applescripts to do this on my own.
Thanks in advance...