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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the ability for custom layouts to hide/show widows #1603

Open
j-o-sh opened this issue Feb 17, 2024 · 8 comments
Open

Add the ability for custom layouts to hide/show widows #1603

j-o-sh opened this issue Feb 17, 2024 · 8 comments

Comments

@j-o-sh
Copy link

j-o-sh commented Feb 17, 2024

First of all: Thank you for creating Amethyst. It is a superb tool for my workflow. 馃檹馃コ

I have been playing around with cutom layouts, since I would like a very particular layout that

  • acts like Fullscreen if there is only one Window visible
  • acts like Tall with two Windows visible
  • hides any additional windows completely and allows me to toggle through all the windows that aren't the main window with a layout action, always activating and showing the next window while hiding the previous one.

With this layout I could have a two-panel screen setup, where my main terminal (with tmux, neovim, etc.) always stays on the left, while I can switch between different supplementary apps on the right.

However I ran into the issue that I couldn't find out how to show or hide windows fro a custom layout and I fear it may not even be possible right now.

Could this be done? Maybe even by returning the window with visible: false from the getFrameAssignments method?

Or something like:

getFrameAssignments(windows, screen, state) {
  return {
    [windows[0].id]: mainFrame(window[0]),
    [windows[activeAside].id: sideFrame(window[activeAside]),
    // every other window - setting the id to `false` instead of a frame would hide it?
    [windows[x].id]: false
  }
}
@ianyh
Copy link
Owner

ianyh commented Feb 17, 2024

You could give all of the supplementary windows the same frame and focus the "visible" one.

@j-o-sh
Copy link
Author

j-o-sh commented Feb 17, 2024

Yes, that is basically how I do it with the 'Tall' layout at the moment.

The problem here is only that this doesn't allow me to switch the supplementary window quickly, while staying im my editor. If I could hide windows from the getFrameAssignments method or even just switch their z-stacking, I could cycle through them with a single layout command. ;)

@ianyh
Copy link
Owner

ianyh commented Feb 17, 2024

Ah, I see the problem, yeah. You can try setting a max windows count, and see if that does what you want. It will minimize rather than hide, but functionally should be pretty much the same.

@ianyh
Copy link
Owner

ianyh commented Feb 17, 2024

Oh, actually, maybe that has the same cycling problem.

@ianyh
Copy link
Owner

ianyh commented Feb 17, 2024

I think it would be mostly straightforward to add hiding as a custom layout capability. I don't have the bandwidth immediately, but it could make for a good contribution if anyone has cycles to put towards it.

@j-o-sh
Copy link
Author

j-o-sh commented Feb 17, 2024

Unfortunatelly yes. Also, maxWindowCount is global and not per layout. 馃

As to contributing: Could you point me into the direction of where I would start doing that? I may try if I can do that if that's cool with you. Or maybe even code that layout as a Swift one?

@j-o-sh
Copy link
Author

j-o-sh commented Feb 17, 2024

...while I am at it: Is there a way to get at the settings for screenPadding and window Margins in a custom layout?

@ianyh
Copy link
Owner

ianyh commented Feb 17, 2024

Not currently, no. And I would prefer that we add it as a capability of custom layouts. You can look at CustomLayout.swift and ReflowOperation.swift.

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

No branches or pull requests

2 participants