Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add Two Pane Right layout #1216

Open
TypicalFence opened this issue Mar 8, 2022 · 9 comments · May be fixed by #1515
Open

add Two Pane Right layout #1216

TypicalFence opened this issue Mar 8, 2022 · 9 comments · May be fixed by #1515

Comments

@TypicalFence
Copy link

Is your feature request related to a problem? Please describe.
I really like the two pane layout, but I'd like to have the main window to be on the right and cycle thru the other windows on the left.
What I am looking for is basically similar to the Tall Right layout.

Describe the solution you'd like
Basically the addition of said layout. I have seen some work been done on the ability to add custom layouts, but this request is rather basic as its just flipped. I might implement it if I ever figure out how to build this software myself.

Describe alternatives you've considered
To wait for the before mentioned custom layout feature.

@diocletiann
Copy link

This would also work well for a multi-monitor setup where you may want to keep the main window closer to the center.

@BlairCurrey
Copy link

BlairCurrey commented Sep 6, 2022

This would also work well for a multi-monitor setup where you may want to keep the main window closer to the center.

Or a multi monitor setup where you want to keep the main window to the end. Depending on how you have your multiple monitors setup. My main monitor is on the right, so a main pane on the left of my right monitor puts it in the center, which I don't prefer.

@mattbui
Copy link

mattbui commented Nov 22, 2022

+1 for this, here's my current workaround with custom layout. But it doesn't work with native shrink/expand commands and mouse resizing though.

function layout() {
    return {
        name: "Two Pane Right",
        initialState: {
            mainPaneCount: 1,
            mainPaneRatio: 0.5
        },
        commands: {
            command1: {
                description: "Shrink main pane",
                updateState: (state) => {
                    return { ...state, mainPaneRatio: Math.max(0.1, state.mainPaneRatio - 0.05) };
                }
            },
            command2: {
                description: "Expand main pane",
                updateState: (state) => {
                    return { ...state, mainPaneRatio: Math.min(0.9, state.mainPaneRatio + 0.05) };
                }
            }
        },
        getFrameAssignments: (windows, screenFrame, state) => {
            const mainPaneCount = Math.min(state.mainPaneCount, windows.length);
            const secondaryPaneCount = windows.length - mainPaneCount;
            const hasSecondaryPane = secondaryPaneCount > 0;

            const mainPaneWindowHeight = screenFrame.height / mainPaneCount;
            const secondaryPaneWindowHeight = screenFrame.height;

            const mainPaneWindowWidth = hasSecondaryPane? Math.round(screenFrame.width * state.mainPaneRatio) : screenFrame.width;
            const secondaryPaneWindowWidth = screenFrame.width - mainPaneWindowWidth

            return windows.reduce((frames, window, index) => {
                const isMain = index < mainPaneCount;
                let frame;
                if (isMain) {
                    frame = {
                        x: screenFrame.x + secondaryPaneWindowWidth,
                        y: screenFrame.y,
                        width: mainPaneWindowWidth,
                        height: mainPaneWindowHeight
                    };
                } else {
                    frame = {
                        x: screenFrame.x,
                        y: screenFrame.y,
                        width: secondaryPaneWindowWidth,
                        height: secondaryPaneWindowHeight
                    }
                }
                return { ...frames, [window.id]: frame };
            }, {});
        }
    };
}

@TypicalFence
Copy link
Author

@mattbui

native shrink/expand commands

Is there a way to add that via custom layouts or not?

@mattbui
Copy link

mattbui commented Dec 7, 2022

@TypicalFence not that I know of, currently I set separate shortcuts for custom command 1 and custom command 2

@Fau818
Copy link

Fau818 commented Mar 16, 2023

I would also love to have the Two Pane Right layout.

Will this ever be achieved?

@sw-tracker
Copy link

+1, I would also love to have a "Two Pane Right" layout :)

@TypicalFence TypicalFence linked a pull request Jun 19, 2023 that will close this issue
@maxim-uvarov
Copy link

I would also love to have the 'Two Pane Right' layout.

@maxim-uvarov
Copy link

@mattbui Thank you for the custom layout. Do you happen to have any updates for it? The version from your comment (#1216 (comment)) won't work with Amethyst 0.19.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants