i3-save-tree: only create "swallows" key for leaf nodes (Thanks xeen)
fixes #1149
This commit is contained in:
parent
2fea5ef82b
commit
bb482e2869
15
i3-save-tree
15
i3-save-tree
@ -1,7 +1,7 @@
|
|||||||
#!/usr/bin/env perl
|
#!/usr/bin/env perl
|
||||||
# vim:ts=4:sw=4:expandtab
|
# vim:ts=4:sw=4:expandtab
|
||||||
#
|
#
|
||||||
# © 2013 Michael Stapelberg
|
# © 2013-2014 Michael Stapelberg
|
||||||
#
|
#
|
||||||
# Requires perl ≥ v5.10, AnyEvent::I3 and JSON::XS
|
# Requires perl ≥ v5.10, AnyEvent::I3 and JSON::XS
|
||||||
|
|
||||||
@ -149,12 +149,15 @@ sub dump_containers {
|
|||||||
say "$ws// $desc with " . @{$tree->{nodes}} . " children";
|
say "$ws// $desc with " . @{$tree->{nodes}} . " children";
|
||||||
}
|
}
|
||||||
|
|
||||||
# Turn “window_properties” into “swallows” expressions.
|
# Turn “window_properties” into “swallows” expressions, but only for leaf
|
||||||
my $swallows = {};
|
# nodes. It only makes sense for leaf nodes to swallow anything.
|
||||||
for my $property (keys %{$tree->{window_properties}}) {
|
if (leaf_node($tree)) {
|
||||||
$swallows->{$property} = '^' . quotemeta($tree->{window_properties}->{$property}) . '$';
|
my $swallows = {};
|
||||||
|
for my $property (keys %{$tree->{window_properties}}) {
|
||||||
|
$swallows->{$property} = '^' . quotemeta($tree->{window_properties}->{$property}) . '$';
|
||||||
|
}
|
||||||
|
$tree->{swallows} = [ $swallows ];
|
||||||
}
|
}
|
||||||
$tree->{swallows} = [ $swallows ];
|
|
||||||
delete $tree->{window_properties};
|
delete $tree->{window_properties};
|
||||||
|
|
||||||
my @keys = sort keys %$tree;
|
my @keys = sort keys %$tree;
|
||||||
|
Loading…
Reference in New Issue
Block a user