aboutsummaryrefslogtreecommitdiff
path: root/i3-save-tree
diff options
context:
space:
mode:
authorIngo Bürk <ingo.buerk@tngtech.com>2015-03-21 17:10:20 +0100
committerIngo Bürk <ingo.buerk@tngtech.com>2015-03-21 17:10:20 +0100
commit0e0581c6cbf81471dc3bb6aeb98a48abcb00da6b (patch)
tree5cb6df5f8f77d41f2635d8dce90f114e79f8feee /i3-save-tree
parente7753c839f556469d6c5fb0f86ebdc36d90c4cba (diff)
downloadi3-0e0581c6cbf81471dc3bb6aeb98a48abcb00da6b.tar.gz
i3-0e0581c6cbf81471dc3bb6aeb98a48abcb00da6b.zip
Allow referencing the workspace by number.
This allows "--workspace 3" for numbered workspaces, e.g., if the name is actually "3:foo". This introduces the same functionality the IPC already offers in many places.
Diffstat (limited to 'i3-save-tree')
-rwxr-xr-xi3-save-tree9
1 files changed, 5 insertions, 4 deletions
diff --git a/i3-save-tree b/i3-save-tree
index b6ed085e..289fd8c6 100755
--- a/i3-save-tree
+++ b/i3-save-tree
@@ -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>