kasper / phoenix

A lightweight macOS window and app manager scriptable with JavaScript
https://kasper.github.io/phoenix/
Other
4.36k stars 128 forks source link

Wrong return type for Window.screen #321

Closed fabiospampinato closed 1 year ago

fabiospampinato commented 1 year ago

Apparently it's possible for a window to be in no screen, while still not being minimized, so the return type of Window.screen should probably be Screen | undefined I guess.

To reproduce:

  1. Get the cursor close to the top edge of a window, so that the cursor turns into the vertical resize arrows.
  2. Drag horizontally, to initiate a drag of the window.
  3. Drag the window as far bottom as possible.
  4. If done correctly the window will be out of bounds of screen, and calling .screen () on it will return you undefined back.

I suppose a window can also be positioned out of the bounds of the screen via the APIs?

Alternatively it may be interesting if this was automatically normalized so that the closest screen were returned, if that makes sense 🤔

kasper commented 1 year ago

Interesting catch, thanks!