Skip to content

Instantly share code, notes, and snippets.

@theanht1
Last active February 12, 2026 22:41
Show Gist options
  • Select an option

  • Save theanht1/74b4c12a16d2f24e6ea15284bfd9ec57 to your computer and use it in GitHub Desktop.

Select an option

Save theanht1/74b4c12a16d2f24e6ea15284bfd9ec57 to your computer and use it in GitHub Desktop.
Amethyst layout for 2 overlapped columns, adjust the setting in `initialState`
function layout() {
return {
name: "TwoOverlappedColumns",
initialState: {
mainPaneRatio: 0.5,
overlapPixels: 144,
},
recommendMainPaneRatio: (ratio, state) => {
return { ...state, mainPaneRatio: ratio };
},
getFrameAssignments: (windows, screenFrame, state) => {
const frameWidth = Math.round(
screenFrame.width / 2 + state.overlapPixels
);
return windows.reduce((frames, window, index) => {
if (index % 2 === 0) {
const frame = {
x: screenFrame.x,
y: screenFrame.y,
width: frameWidth,
height: screenFrame.height,
isMain: true,
unconstrainedDimension: "horizontal",
};
return { ...frames, [window.id]: frame };
} else {
const frame = {
x:
screenFrame.x +
screenFrame.width * state.mainPaneRatio -
state.overlapPixels,
y: screenFrame.y,
width: frameWidth,
height: screenFrame.height,
isMain: false,
unconstrainedDimension: "horizontal",
};
return { ...frames, [window.id]: frame };
}
}, {});
},
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment