When I run an AppleScript from an application in fullscreen, for example Google Chrome, the system will change the focus to the desktop and leave the application was is in fullscreen.

tell application "Google Chrome"
    delay 0.8
    tell application "System Events"
        keystroke "c" using command down
    end tell
end tell

Is there any way to stop switching to the desktop and stay in fullscreen mode ?

I know you can return to fullscreen mode with…

tell application "Google Chrome" to activate

…but it is very annoying to go back to the desktop, even quickly, each time the script runs.

  • How are you calling the script? From Script Editor, saved as an app...? – Tetsujin Mar 5 '18 at 8:20
  • Most of the time as an individual App but sometime I call the script from other app (e.x text expander or Keyboard Maestro) thinking about it, it's make sense to have this behaviour if running as an app – Kevin Mar 5 '18 at 8:51
  • Yup - the first thing it does is launch... which will be in another Space to the fullscreen app, as they won't share Spaces with anything else. Maybe consider setting it up as a Service in Automator, then you can key-command it; that way it won't need to come to the front first. – Tetsujin Mar 5 '18 at 8:56
  • 1
    Different script/purpose, but the method is here - apple.stackexchange.com/a/258741/85275 – Tetsujin Mar 5 '18 at 8:58

You must log in to answer this question.

Browse other questions tagged .