Skip to content

Commit d176e7d

Browse files
committed
2 parents 3f7c346 + 44f11e3 commit d176e7d

File tree

1 file changed

+20
-5
lines changed

1 file changed

+20
-5
lines changed

src/main/window-manager.ts

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -203,10 +203,25 @@ export class WindowManager {
203203

204204
private continueSetWindowModePet(): void {
205205
if (!this.window) return;
206-
207-
const { width, height } = screen.getPrimaryDisplay().workAreaSize;
208-
209-
this.window.setSize(width, height);
206+
// Calculate the bounding rectangle that covers all connected displays.
207+
// This allows the transparent pet-mode window to span across monitors,
208+
// so the avatar can be dragged freely between them.
209+
const displays = screen.getAllDisplays();
210+
const minX = Math.min(...displays.map((d) => d.bounds.x));
211+
const minY = Math.min(...displays.map((d) => d.bounds.y));
212+
const maxX = Math.max(...displays.map((d) => d.bounds.x + d.bounds.width));
213+
const maxY = Math.max(...displays.map((d) => d.bounds.y + d.bounds.height));
214+
const combinedWidth = maxX - minX;
215+
const combinedHeight = maxY - minY;
216+
217+
// Resize and position the window to cover the entire virtual screen
218+
// so the avatar is not clipped when dragged to a second monitor.
219+
this.window.setBounds({
220+
x: minX,
221+
y: minY,
222+
width: combinedWidth,
223+
height: combinedHeight,
224+
});
210225

211226
if (isMac) this.window.setWindowButtonVisibility(false);
212227
this.window.setResizable(false);
@@ -224,7 +239,7 @@ export class WindowManager {
224239

225240
this.window.webContents.send('mode-changed', 'pet');
226241
}
227-
242+
228243
getWindow(): BrowserWindow | null {
229244
return this.window;
230245
}

0 commit comments

Comments
 (0)