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

Save restore dwindle layout #9054

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

Natr1x
Copy link

@Natr1x Natr1x commented Jan 13, 2025

Describe your PR, what does it fix/add?

To make it possible to save and restore dwindle workspace layouts via hyprctl.

To be able to "restore" layouts it adds an "opennexton" layoutmsg handler for the dwindle layout. It works like "preselect" but with a dwindle node instead.

"Saving" layouts is done with hyprctl layoutdata workspaceinfo <workspace_id>.

The hyprctl cmd ("layoutdata") which kind of does the same thing as "dispatch layoutmsg" but allows the layout to send a response. workspaceinfo is then a handler implemented for the dwindle layout.

Is there anything you want to mention? (unchecked code, possible bugs, found problems, breaking compatibility, etc.)

Some points which need to be discussed:

  • The format of the first argument to the opennexton layoutmsg handler may not be particularly intuitive. I think there should be a way to target nodes which contain more than one window. And targeting the root is really useful if you want to do something like "maximize to half the screen". But it may be better to just leave out that functionality for now.
  • The names "layoutdata" and "workspaceinfo" for the new hyprctl cmd should probably be something else. (Especially "layoutdata"). I don't like that a new hyprctl command was needed to begin with but I don't see how else you would do it.
  • Something like a "setnodesplitratio" layoutmsg handler is also needed if you want to restore the window sizes of the layout. I thought dispatch splitratio could be used it does not take a window argument. And even if it did there would be no way to target nodes which are not single windows.
  • Master layout? This is currently only for the dwindle layout and I don't see how it could be done in a generic way which would work with every possible layout. But if we are adding a new layout specific hyprctl command then maybe we should implement at least the "workspaceinfo" handler for the master layout as well.

Is it ready for merging, or does it need work?

NO, the questions above need to be addressed first. But aside from that there is also the documentation and stuff like tab completions for hyprctl.

@vaxerski
Copy link
Member

How would this be used, exactly?

@Cool-Game-Dev
Copy link

Cool-Game-Dev commented Jan 15, 2025

How would this be used, exactly?

Personally, I like to have my windows in a specific arrangement when I'm working, and I hate having to remake the layout every time, so that's how I would use it.

@zakk4223
Copy link
Contributor

It's not entirely clear to me how restoring is supposed to work with this?

There's some utility to making this generic (i.e a matching 'restore your state from this dump you provided earlier' dispatcher). Being able to do stuff like gather all windows on a workspace into a tabbed group and then 'release' them back into the layout with the same exact positioning as before would be one use for a generic save/restore.

Unfortunately I don't think there's a good way to do this without requiring every layout to contain a json parser....

@vaxerski
Copy link
Member

that would be understandable but I am asking in this MR, specifically, cuz I fail to see it

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

Successfully merging this pull request may close these issues.

4 participants