| 918 | } |
| 919 | |
| 920 | function getDisplayForQuakeToggle() { |
| 921 | // We cannot reliably query the OS-wide active window in Electron. |
| 922 | // Cursor position is the best cross-platform proxy for the user's active display. |
| 923 | const cursorPoint = screen.getCursorScreenPoint(); |
| 924 | const displayAtCursor = screen |
| 925 | .getAllDisplays() |
| 926 | .find( |
| 927 | (display) => |
| 928 | cursorPoint.x >= display.bounds.x && |
| 929 | cursorPoint.x < display.bounds.x + display.bounds.width && |
| 930 | cursorPoint.y >= display.bounds.y && |
| 931 | cursorPoint.y < display.bounds.y + display.bounds.height |
| 932 | ); |
| 933 | return displayAtCursor ?? screen.getDisplayNearestPoint(cursorPoint); |
| 934 | } |
| 935 | |
| 936 | function moveWindowToDisplay(win: WaveBrowserWindow, targetDisplay: Electron.Display) { |
| 937 | if (!win || !targetDisplay || win.isDestroyed()) { |