Skip to content

Instantly share code, notes, and snippets.

@haleyrc
Created April 11, 2024 15:48
Show Gist options
  • Save haleyrc/3d089b2bc9d880716d71025bd8c31235 to your computer and use it in GitHub Desktop.
Save haleyrc/3d089b2bc9d880716d71025bd8c31235 to your computer and use it in GitHub Desktop.
A four-pane layout for Amethyst
function layout() {
return {
name: "Quadrants",
getFrameAssignments: (windows, screenFrame) => {
const columnWidth = screenFrame.width / 2;
const rowHeight = screenFrame.height / 2;
const frames = windows.map((window, index) => {
const frame = {
x: screenFrame.x + (columnWidth * (index % 2)),
y: screenFrame.y + (index < 2 ? 0 : rowHeight),
width: columnWidth,
height: rowHeight
};
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