fix initialization errors using driver.love

Changes inside on.initialize are minefields. Until now, if you made a mistake when modifying on.initialize, you could end up in a situation where the app would fail irrecoverably on the next startup. You'd have to go dig up a text editor to fix it.

After this commit, errors in on.initialize wait for commands from driver.love just like any other error.

Recovering from errors during initialization is a little different than normal. I don't know how much of initialization completed successfully, so I redo all of it.

I think this should be safe; the sorts of things we want to do on startup tend to be idempotent just like the sorts of things we do within an event loop with our existing error handling.

Things are still not ideal. Initialization by definition happens only when the app starts up. When you make changes to it, you won't find out about errors until you restart the app[1], which can be much later and a big context switch. But at least you'll be able to fix it in the usual way. Slightly more seamless[2].

One glitch to note: at least on Linux, an app with an initialization error feels "sticky". I can't seem to switch focus away from it using Alt-tab. Hitting F4 on the driver also jarringly brings the client app back in focus when there was an initialization error. But the mouse does work consistently. This feels similar to the issues I find when an app goes unresponsive sometimes. The window manager really wants me to respond to the dialog that it's unresponsive.

Still, feels like an improvement.

[1] I really need to provide that driver command to restart the app! But there's no room in the menus! I really need a first-class command palette like pensieve.love has!

[2] https://lobste.rs/s/idi1wt/open_source_vs_ux

Created by  akkartik  on November 17, 2023
5WHW3IDOHOBXY3M3QPXNMHFFNXXD6RR5B2WL6TB5TTVNZJYCN2AQC
Change contents