JonnyHaystack / i3-resurrect

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

Error when trying to save a workspace with placeholders #39

Closed infokiller closed 4 years ago

infokiller commented 5 years ago

Describe the bug When trying to save a workspace with placeholders, the python script fails with an error because the placeholder window doesn't have the "class" attribute. Traceback:

Traceback (most recent call last):
  File "/home/infokiller/.local/bin/i3-resurrect", line 10, in <module>
    sys.exit(main())
  File "/home/infokiller/.local/lib/python3.6/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/home/infokiller/.local/lib/python3.6/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/home/infokiller/.local/lib/python3.6/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/infokiller/.local/lib/python3.6/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/infokiller/.local/lib/python3.6/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/home/infokiller/.local/lib/python3.6/site-packages/i3_resurrect/main.py", line 54, in save_workspace
    save_layout(workspace, directory, swallow_criteria)
  File "/home/infokiller/.local/lib/python3.6/site-packages/i3_resurrect/main.py", line 74, in save_layout
    util.build_tree(workspace_tree, swallow_criteria),
  File "/home/infokiller/.local/lib/python3.6/site-packages/i3_resurrect/util.py", line 74, in build_tree
    container['nodes'] = build_tree(node, swallow)
  File "/home/infokiller/.local/lib/python3.6/site-packages/i3_resurrect/util.py", line 62, in build_tree
    window_class = node['window_properties']['class']
KeyError: 'class'

To Reproduce Steps to reproduce the behavior:

  1. Create a placeholder container (for example by using i3-resurrect restore with placeholders that don't match a container)
  2. Run i3-resurrect save on that workspace
  3. See error

Expected behavior Workspace saved correctly.

System information (please complete the following information):

JonnyHaystack commented 5 years ago

Hi, thanks for the report. This is actually already fixed on the "next" branch because I noticed it yesterday while adding floating window support and looking into the issue of restoring workspace properties. The fix will be included whenever I do the next release, but I would like to get some more features in before then.