Skip to content

Instantly share code, notes, and snippets.

@thewinger
Created August 5, 2022 09:31
Show Gist options
  • Save thewinger/92cc709716ce207873b2a90becd8a72c to your computer and use it in GitHub Desktop.
Save thewinger/92cc709716ce207873b2a90becd8a72c to your computer and use it in GitHub Desktop.
function layout() {
return {
name: 'Web Dev',
getFrameAssignments: (windows, screenFrame) => {
const webWidth = 1319
const secondaryHeight = screenFrame.height / windows.length
let frame
const frames = windows.map((window, index) => {
if (index === 1) {
frame = {
x: screenFrame.x,
y: screenFrame.y,
width: screenFrame.width - webWidth,
height: screenFrame.height,
}
} else {
frame = {
x: screenFrame.width - webWidth,
y: screenFrame.y + secondaryHeight * index,
width: webWidth,
height: screenFrame.height,
}
}
return { [window.id]: frame }
})
return frames.reduce((frames, frame) => ({ ...frames, ...frame }), {})
},
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment