TEAM LICENSES: Save money and learn new skills through a Hacking with Swift+ team license >>

is it possible to make an app open on display 2 in full screen mode?

Forums > macOS

I have a SwiftUI app that we are using as a full screen display in a kiosk. The mac mini running the kiosk has two displays. the kiosk display is set as display 2. The management display is display number 1. Is it possible in code to make the app always launch full screen, and to always launch on display #2? It would be nice if we could reduce the launching instructions for the person driving the kiosk to one double-click instead of double-click the icon, drag the title bar to display 2, click on the green button to go full screen...

so far the best work around I've found is using an applescript that always stays open and moves and resizes the window whenever the kiosk app launches. but that's kind of tenuous.



I'm not sure how to do this in SwiftUI but in macOS to make an app open in a specific desktop or space, right-click on the Kiosk app in the Dock and choose Options and assign it to the desktop you want to use. In Mission Control settings you need to make sure your secondary display has its own space.

I used to force apps to open in fullscreen by editing the Info.plist and setting NSApplicationPresentationMode to 4.


To ensure your SwiftUI app always launches full screen on display #2, follow these steps:

  • Create an AppleScript that positions and sizes the window on display #2.
  • Use the do shell script command in AppleScript to execute a shell command, adjusting the window's position and size as needed.
  • Launch this AppleScript at startup to automate the process.

This approach reduces launching instructions for the kiosk operator to a single double-click on your app's icon.


Hacking with Swift is sponsored by Superwall.

SPONSORED Superwall lets you build & test paywalls without shipping updates. Run experiments, offer sales, segment users, update locked features and more at the click of button. Best part? It's FREE for up to 250 conversions / mo and the Superwall team builds out 100% custom paywalls – free of charge.

Learn More

Sponsor Hacking with Swift and reach the world's largest Swift community!

Reply to this topic…

You need to create an account or log in to reply.

All interactions here are governed by our code of conduct.

Unknown user

You are not logged in

Log in or create account

Link copied to your pasteboard.