Bring similator to the foreground on Run

When developing on a single screen and Nova (and VS Code?) I like to have the editor in full screen mode so when I hit Run it would be better if the simulator would come to the foreground.

1 Like

If you'd like to DIY you can probably use Hammersooon to do this. It's an app to run Lua scripts against macOS user interface.

Here's some Hammerspoon Lua code to:

  1. bring all Simulator windows to front when the app is activated (same as this Hammerspoon example)
  2. raise the main Simulator window to the front of all Simulator windows (one new line added by me)

You might need to change it a little to get exactly what you want. I'm not 100% sure an app can come to the foreground over a fullscreen app, and can't test right now.

-- Playdate Simulator window management
function applicationWatcher(appName, eventType, appObject)
	if (eventType == hs.application.watcher.activated) then
		if (appName == "Playdate Simulator") then
			-- Bring all Playdate Simulator windows forward when one gets activated
			appObject:selectMenuItem({"Window", "Bring All to Front"})
			-- Raise main Simulator window to the front of all Simulator windows
			hs.window.find("Simulator"):raise() 
		end
	end
end
appWatcher = hs.application.watcher.new(applicationWatcher)
appWatcher:start()

I just looked in to this and the Simulator itself can't force itself to the foreground if another app is in full screen mode. I'm not sure if a script could do it from Nova/VS Code, would be worth trying out.

To clarify, I meant the editor is sized to cover most of the screen but it is not in full screen mode. So it should be doable. Thx

1 Like

I've been thinking and it should be possible to change your VSCode build script to focus the Simulator window.

What setup are you using?

I’m using the Nova editor (on a Mac)

Weird,

  • so am I, and Simulator comes to front
  • I press either Cmd+R or choose the Run menu item
  • I use the Nova Playdate Extension

So what might be different about your setup?

Ah, I see that if the console window is displayed only it comes to the foreground. If it isn’t, then the simulator does come to the foreground!

Seems like a bug. But now that I know what to avoid, I’m good.

Pete

1 Like

No worries! The Hammerspoon script above ensures both windows come to the front at the same time.

I see now how it can get confusing. Normally the console window is not displayed so the sim is brought to the foreground correctly. However, if there is a crash in the game then the console window is displayed. So, the next time I run the app only the console is brought to the foreground.

What is the best way to report this bug for Nova?

This isn't really a bug, but normal macOS window interleaving behavior. That said, we have a request in our tracker about always bringing the main window to the foreground in cases like this.