]> git.sur5r.net Git - i3/i3/blobdiff - i3-save-tree
Display which config is used in --more_version
[i3/i3] / i3-save-tree
index b6ed085ec7b836a55d3ec3e22dd58ff7cf59acd9..18a1a38068b7da28b9b4efd69c92da4bbb6e4a72 100755 (executable)
@@ -1,7 +1,7 @@
 #!/usr/bin/env perl
 # vim:ts=4:sw=4:expandtab
 #
-# © 2013-2014 Michael Stapelberg
+# © 2013 Michael Stapelberg
 #
 # Requires perl ≥ v5.10, AnyEvent::I3 and JSON::XS
 
@@ -222,7 +222,7 @@ my $tree = $i3->get_tree->recv;
 my $dump;
 if (defined($workspace)) {
     $dump = filter_containers($tree, sub {
-        $_->{type} eq 'workspace' && $_->{name} eq $workspace
+        $_->{type} eq 'workspace' && ($_->{name} eq $workspace || ($workspace =~ /^\d+$/ && $_->{num} eq $workspace))
     });
 } else {
     $dump = filter_containers($tree, sub {
@@ -252,7 +252,7 @@ for my $key (qw(nodes floating_nodes)) {
 
 =head1 SYNOPSIS
 
-    i3-save-tree [--workspace=name] [--output=name]
+    i3-save-tree [--workspace=name|number] [--output=name]
 
 =head1 DESCRIPTION
 
@@ -271,9 +271,10 @@ If neither argument is specified, the currently focused workspace will be used.
 
 =over
 
-=item B<--workspace=name>
+=item B<--workspace=name|number>
 
-Specifies the workspace that should be dumped, e.g. 1.
+Specifies the workspace that should be dumped, e.g. 1. This can either be a
+name or the number of a workspace.
 
 =item B<--output=name>