-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbroken-monitor.js
34 lines (32 loc) · 1.19 KB
/
broken-monitor.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
function layout() {
return {
name: "Broken monitor",
getFrameAssignments: (windows, screenFrame) => {
const leftPaneWidth = 2000;
const crackWidth = 460;
const rightPaneWidth = screenFrame.width - leftPaneWidth - crackWidth;
const rightWindowsHeight = screenFrame.height / (windows.length - 1);
const frames = windows.map((window, index) => {
if (index === 0) {
return {
[window.id]: {
x: screenFrame.x,
y: screenFrame.y,
width: leftPaneWidth,
height: screenFrame.height
}
};
}
return {
[window.id]: {
x: screenFrame.x + leftPaneWidth + crackWidth,
y: screenFrame.y,
width: rightPaneWidth,
height: rightWindowsHeight
}
};
});
return frames.reduce((frames, frame) => ({ ...frames, ...frame }), {});
}
};
}