JonnyHaystack / i3-resurrect

Simple solution to saving and restoring i3 workspaces
GNU General Public License v3.0
379 stars 19 forks source link

backup/restore workspace to original monitor #101

Open aarobc opened 3 years ago

aarobc commented 3 years ago

Is your feature request related to a problem? Please describe. Currently the only way to assign a workspace to a monitor is to hardcode it within the i3 config file. This is inconvenient as it limits the portability of the i3 config between machines with different display configurations.

Describe the solution you'd like Upon saving a workspace layout, the current monitor is recorded under an additional property.

Upon restoring a workspace layout, it's created on the monitor configured in the layout file.

Describe alternatives you've considered Hardcoding the workspace within the i3 config. This is much too limiting.

JonnyHaystack commented 3 years ago

Why not just assign your workspaces to monitors in the i3 config?

EDIT: Sorry I should clarify based on your first sentence. My solution to this is to have my i3 config generated by a script that reads config files from ~/.config/i3/conf.d/. These can be plain text i3 config or bash or python scripts. I get monitor info from xrandr and dynamically allocate the workspaces to monitors based on that info. You can see here how I do this https://github.com/JonnyHaystack/dotfiles/tree/master/i3

It's a shame that assigning workspaces can't be done via an i3ipc command but there are plenty of advantages to making your config scriptable like this anyway.

aarobc commented 3 years ago

You're talking about assigning the workspace permanently. My request was to do a one time "move workspace to monitor" step on only when the restore is run. I feel like this would be more consistent with what a user would expect.

You could include the output within the generated config, and upon restore, preform something like

i3.workspace(str(workspace))                                  
i3.command('move', 'workspace to output ' + output['name']) 

This would accommodate a much broader range of i3 users, and not require dynamically generating the i3 config (which I'm averse to).

JonnyHaystack commented 3 years ago

Okay, I get you. i3-resurrect is generally designed around not having to manually edit the layout files, but this seems like a good feature so I'm happy to give that option in the case that you do want to manually add it.

aarobc commented 3 years ago

I apologize for the confusion, but my request hopes to avoid any manual editing at all:

JonnyHaystack commented 3 years ago

Right, I can make a command line flag for that then, seeing as people might not want that behaviour by default