[i3] i3-save-tree questions continued

2014-09-16 Thread Sargrad, Dave
I almost have this working. 

Can someone please explain to me what the following code snippet (drawn from 
i3-save-tree) does:


for my $key (qw(nodes floating_nodes)) {
$tree-{$key} = [ map { strip_containers($_) } @{$tree-{$key}} ];
}

I think this is making a recursive call to strip_containers, for containers 
that container either nodes or floating_nodes.

I don’t see the code that actually deletes empty nodes and empty 
floating_nodes. Perhaps this code does that as well through the creation of a 
new map that contains just the allowed_keys..



-Original Message-
From: i3-discuss [mailto:i3-discuss-boun...@i3.zekjur.net] On Behalf Of 
i3-discuss-requ...@i3.zekjur.net
Sent: Tuesday, September 16, 2014 6:01 AM
To: i3-discuss@i3.zekjur.net
Subject: i3-discuss Digest, Vol 53, Issue 6

Send i3-discuss mailing list submissions to
i3-discuss@i3.zekjur.net

To subscribe or unsubscribe via the World Wide Web, visit
http://infra.in.zekjur.net/cgi-bin/mailman/listinfo/i3-discuss
or, via email, send a message with subject or body 'help' to
i3-discuss-requ...@i3.zekjur.net

You can reach the person managing the list at
i3-discuss-ow...@i3.zekjur.net

When replying, please edit your Subject line so it is more specific than Re: 
Contents of i3-discuss digest...


Today's Topics:

   1. Re: i3-discuss Digest, Vol 53, Issue 5 (Sargrad, Dave)


--

Message: 1
Date: Mon, 15 Sep 2014 18:50:01 +
From: Sargrad, Dave dave.sarg...@saabsensis.com
To: i3-discuss@i3.zekjur.net i3-discuss@i3.zekjur.net
Subject: Re: [i3] i3-discuss Digest, Vol 53, Issue 5
Message-ID:
85ea6f68ac24da48b220ebea7a8c08b81b506...@corpmail01.corp.sensis.com
Content-Type: text/plain; charset=utf-8

Ok. I have made even further headway with this. Let me summarize what I think I 
have learned:

1] By removing the window_properties from the spec I was able to get the 
swallows to work properly 2] By only including the leaf nodes I was able to 
append, rather than overlay. 

So it would seem that i3 has the ability to not only append a layout but to 
overlay a layout (onto an existing workspace). This almost seems like a 
feature. Though I am not sure what unintended consequences there might be.

The latter can be seen in two examples:
The following spec does an append:

{
window_properties: {title: mo},
fullscreen_mode: 0,
floating: auto_off,
border: normal,
layout: splith,
percent: 0.5,
nodes: [],
type: con,
swallows: [
{
class: ^XTerm$
}
],
name: one,
geometry: {y: 0, x: 0, height: 316, width: 484} }

{
fullscreen_mode: 0,
floating: auto_off,
border: normal,
layout: splith,
percent: 0.5,
nodes: [],
type: con,
swallows: [
{
class: ^XTerm$
}
],
name: two,
geometry: {y: 0, x: 0, height: 316, width: 484} }

Whereas by keeping the parent workspace we end up with an overlay:

{
fullscreen_mode: 1,
floating: auto_off,
 border: normal,
layout: splith,
percent: null,
 nodes: [
  {
 fullscreen_mode: 0,
 floating: auto_off,
 border: normal,
 layout: splith,
 percent: 0.5,
 nodes: [],
 type: con,
 swallows: [{class: ^XTerm$}],
 name: one,
 geometry: {y: 0, x: 0, height: 316, width: 484}},
 {
 fullscreen_mode: 0,
 floating: auto_off,
 border: normal,
 layout: splith,
 percent: 0.5,
 nodes: [],
 type: con,
 swallows: [{class: ^XTerm$}],
 name: two,
 geometry: {y: 0, x: 0, height: 316, width: 484}}
 ],
type: workspace,
swallows: []
}

-Original Message-
From: i3-discuss [mailto:i3-discuss-boun...@i3.zekjur.net] On Behalf Of 
i3-discuss-requ...@i3.zekjur.net
Sent: Monday, September 15, 2014 1:41 PM
To: i3-discuss@i3.zekjur.net
Subject: i3-discuss Digest, Vol 53, Issue 5

Send i3-discuss mailing list submissions to
i3-discuss@i3.zekjur.net

To subscribe or unsubscribe via the World Wide Web, visit
http://infra.in.zekjur.net/cgi-bin/mailman/listinfo/i3-discuss
or, via email, send a message with subject or body 'help' to
i3-discuss-requ...@i3.zekjur.net

You can reach the person managing the list at
i3-discuss-ow...@i3.zekjur.net

When replying, please edit your Subject line so it is more specific than Re: 
Contents of i3-discuss digest...


Today's Topics:

   1. i3 layout save/restore (Sargrad, Dave)
   2. Re: i3 layout save/restore (Sargrad, Dave)


--

Message: 1
Date: Mon, 15 Sep 2014 16:33:04 +
From: Sargrad, Dave dave.sarg...@saabsensis.com
To: 

[i3] i3 save/restore bug

2014-09-16 Thread Sargrad, Dave
I've found a bug with the i3 save/restore mechanism

In general the save/load works fine (I've tried a number of layouts that work 
fine), however I have found a simple configuration that fails to save/load 
correctly. I'm not sure yet if this is a problem with i3, or with i3-save-tree.

I opened three windows in a workspace (and then saved using i3-save-tree 
--workspace test  /home/ubuntu/.i3/spec)
2 xterms side-by-side in top row
1 emacs in bottom row (I used the mod-shift-k to move emacs down)


Correct Layout (the layout I saved with i3-save-tree)
_
||   |
||   |
||   |
|  xterm | xterm |
||   |
||   |
||   |
||   |
-
||
||
||
|  emacs |
||
||
||
||
_

I then appended using i3-msg (i3-msg workspace new; append_layout 
/home/ubuntu/.i3/spec
After Append Layout (Incorrect Result)
_
|| | |
|| | |
|| | |
| xterm  | xterm   |   emacs |
|| | |
|| | |
|| | |
|| | |
|| | |
|| | |
|| | |
_



This is the spec generated by i3-save-tree:


// vim:ts=4:sw=4:et
{
// splith split container with 2 children
border: normal,
floating: auto_off,
layout: splith,
percent: 0.232604373757455,
type: con,
nodes: [
{
border: normal,
floating: auto_off,
geometry: {
   height: 316,
   width: 484,
   x: 0,
   y: 0
},
name: ubuntu@sensis-8930: ~,
percent: 0.5,
swallows: [
   {
   class: ^XTerm$
   }
],
type: con
},
{
border: normal,
floating: auto_off,
geometry: {
   height: 316,
   width: 484,
   x: 0,
   y: 0
},
name: ubuntu@sensis-8930: ~,
percent: 0.5,
swallows: [
   {
   class: ^XTerm$
   }
],
type: con
}
]
}

{
border: normal,
floating: auto_off,
geometry: {
   height: 550,
   width: 602,
   x: 0,
   y: 0
},
name: em...@example.com,
percent: 0.767395626242545,
swallows: [
   {
   class: ^Emacs23$
   }
],
type: con
}
-
This message is intended only for the addressee and may contain information 
that is company confidential or privileged.  Any technical data in this message 
may be exported only in accordance with the U.S. International Traffic in Arms 
Regulations (22 CFR Parts 120-130) or the Export Administration Regulations (15 
CFR Parts 730-774). Unauthorized use is strictly prohibited and may be 
unlawful. If you are not the intended recipient, or the person responsible for 
delivering to the intended recipient, you should not read, copy, disclose or 
otherwise use this message. If you have received this email in error, please 
delete it, and advise the sender immediately. 
-  

Re: [i3] i3 save/restore bug

2014-09-16 Thread Michael Stapelberg
This is a duplicate of http://bugs.i3wm.org/report/ticket/1297

On Tue, Sep 16, 2014 at 5:49 PM, Sargrad, Dave
dave.sarg...@saabsensis.com wrote:
 Ok. I've dug further, and am sure that this is a problem with i3-save-tree.

 The containing workspace (container type = workspace) has some critical 
 information that is stripped away by i3-save-tree. Specifically the workspace 
 container structure (including the splitv layout) is lost as part of the 
 pruning process.

 I can provide the entire tree associated with the workspace if that would 
 help. But I think perhaps I've given enough detail to understand the issue.

 Please let me know if I should provide additional diagnostics.


 -Original Message-
 From: Sargrad, Dave
 Sent: Tuesday, September 16, 2014 11:09 AM
 To: i3-discuss@i3.zekjur.net
 Subject: i3 save/restore bug

 I've found a bug with the i3 save/restore mechanism

 In general the save/load works fine (I've tried a number of layouts that work 
 fine), however I have found a simple configuration that fails to save/load 
 correctly. I'm not sure yet if this is a problem with i3, or with 
 i3-save-tree.

 I opened three windows in a workspace (and then saved using i3-save-tree 
 --workspace test  /home/ubuntu/.i3/spec)
 2 xterms side-by-side in top row
 1 emacs in bottom row (I used the mod-shift-k to move emacs down)


 Correct Layout (the layout I saved with i3-save-tree) 
 _
 ||   |
 ||   |
 ||   |
 |  xterm | xterm |
 ||   |
 ||   |
 ||   |
 ||   |
 -
 ||
 ||
 ||
 |  emacs |
 ||
 ||
 ||
 ||
 _

 I then appended using i3-msg (i3-msg workspace new; append_layout 
 /home/ubuntu/.i3/spec
 After Append Layout (Incorrect Result)
 _
 || | |
 || | |
 || | |
 | xterm  | xterm   |   emacs |
 || | |
 || | |
 || | |
 || | |
 || | |
 || | |
 || | |
 _



 This is the spec generated by i3-save-tree:


 // vim:ts=4:sw=4:et
 {
 // splith split container with 2 children
 border: normal,
 floating: auto_off,
 layout: splith,
 percent: 0.232604373757455,
 type: con,
 nodes: [
 {
 border: normal,
 floating: auto_off,
 geometry: {
height: 316,
width: 484,
x: 0,
y: 0
 },
 name: ubuntu@sensis-8930: ~,
 percent: 0.5,
 swallows: [
{
class: ^XTerm$
}
 ],
 type: con
 },
 {
 border: normal,
 floating: auto_off,
 geometry: {
height: 316,
width: 484,
x: 0,
y: 0
 },
 name: ubuntu@sensis-8930: ~,
 percent: 0.5,
 swallows: [
{
class: ^XTerm$
}
 ],
 type: con
 }
 ]
 }

 {
 border: normal,
 floating: auto_off,
 geometry: {
height: 550,
width: 602,
x: 0,
y: 0
 },
 name: em...@example.com,
 percent: 0.767395626242545,
 swallows: [
{
class: ^Emacs23$
}
 ],
 type: con
 }
 -
 This message is intended only for the addressee and may contain information 
 that is company confidential or privileged.  Any technical data in this 
 message may be exported only in accordance with the U.S. International 
 Traffic in Arms Regulations (22 CFR Parts 120-130) or the Export 
 Administration Regulations (15 CFR Parts 730-774). Unauthorized use is 
 strictly