JonnyHaystack / i3-resurrect

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

Window on another workspace is not restored #112

Closed QiangF closed 2 years ago

QiangF commented 2 years ago

Steps to reproduce the behavior:

  1. Go to workspace 1
  2. Open Emacs
  3. Save the layout with: i3-ressurrect save
  4. Move Emacs window to workspace 2
  5. Go to workspace 1
  6. Restore the layout with: i3-resurrect restore

Result The Emacs window is not brought back from workspace 2, instead a new Emacs window is open, and a blank placeholder of the old Emacs window is left in workspace 1.

If this is the expected behavior, only layout on one workspace can be restored, it is not very useful.

Expected behavior The original Emacs window on workspace 2 is brought back from workspace 2.

JonnyHaystack commented 2 years ago

This is just how i3's window swallowing works. The only way to force it to swallow a previously existing window from another workspace is to unmap and remap the window on that workspace. i3-resurrect does this when you do a layout restore. So you could force a swallow by going to workspace 2 and restoring an empty layout profile. But why aren't you just restoring a layout on workspace 1 before opening the window? Or why are you moving the window to workspace 2 after restoring the layout? If you want it back on workspace 1, you could also just move it back to workspace 1 yourself then restore the layout there.. And if you don't want new copies of the program to be launched, just use --layout-only as I said on your other issue (did you read the README?)

If you really want, you could also write a very simple script that restores an empty profile to every workspace, thus triggering all of their windows to be swalloved by a matching placeholder.

QiangF commented 2 years ago

Isn't this supposed to help make things more automated. I have tried --layout-only. Thanks!

JonnyHaystack commented 2 years ago

Yes, and it does, but it isn't magic. If you don't like how i3 window swallowing works you can feel free to open an issue on the i3 repo. Otherwise, feel free to use the workaround I suggested.