Skip to content

Commit 7490cd1

Browse files
committed
fix: windows multi-display
Signed-off-by: Innei <i@innei.in>
1 parent bb43da9 commit 7490cd1

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

src/main/tipc/app.ts

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,8 @@ export const appRoute = {
7171
// FIXME: this is a electron bug, see https://github.com/RSSNext/Follow/issues/231
7272
// So in this way we use a workaround to fix it, that is manually resize the window
7373
if (isWindows11) {
74-
const size = screen.getDisplayMatching(
75-
window.getBounds(),
76-
).workAreaSize
74+
const display = screen.getDisplayMatching(window.getBounds())
75+
const size = display.workAreaSize
7776

7877
const isMaximized = size.height === window.getSize()[1]
7978

@@ -85,8 +84,12 @@ export const appRoute = {
8584
window.setResizable(true)
8685
window.setMovable(true)
8786

88-
window.setSize(stored.size[0], stored.size[1])
89-
window.setPosition(stored.position[0], stored.position[1])
87+
window.setBounds({
88+
width: stored.size[0],
89+
height: stored.size[1],
90+
x: stored.position[0],
91+
y: stored.position[1],
92+
}, true)
9093

9194
delete window[storeKey]
9295
} else {
@@ -98,8 +101,14 @@ export const appRoute = {
98101
}
99102

100103
// Maually Resize
101-
window.setSize(size.width, size.height)
102-
window.setPosition(0, 0)
104+
const { workArea } = display
105+
106+
window.setBounds({
107+
x: workArea.x,
108+
y: workArea.y,
109+
width: workArea.width,
110+
height: workArea.height,
111+
}, true)
103112

104113
window.setResizable(false)
105114
window.setMovable(false)

0 commit comments

Comments
 (0)