retab!
This commit is contained in:
parent
9b737f631d
commit
d94bef2ebb
@ -14,21 +14,21 @@ use v5.10;
|
|||||||
my $i3 = i3("/tmp/nestedcons");
|
my $i3 = i3("/tmp/nestedcons");
|
||||||
|
|
||||||
sub get_workspace_names {
|
sub get_workspace_names {
|
||||||
my $tree = $i3->get_workspaces->recv;
|
my $tree = $i3->get_workspaces->recv;
|
||||||
my @workspaces = map { @{$_->{nodes}} } @{$tree->{nodes}};
|
my @workspaces = map { @{$_->{nodes}} } @{$tree->{nodes}};
|
||||||
[ map { $_->{name} } @workspaces ]
|
[ map { $_->{name} } @workspaces ]
|
||||||
}
|
}
|
||||||
|
|
||||||
sub workspace_exists {
|
sub workspace_exists {
|
||||||
my ($name) = @_;
|
my ($name) = @_;
|
||||||
($name ~~ @{get_workspace_names()})
|
($name ~~ @{get_workspace_names()})
|
||||||
}
|
}
|
||||||
|
|
||||||
sub get_unused_workspace {
|
sub get_unused_workspace {
|
||||||
my @names = get_workspace_names();
|
my @names = get_workspace_names();
|
||||||
my $tmp;
|
my $tmp;
|
||||||
do { $tmp = tmpnam() } while ($tmp ~~ @names);
|
do { $tmp = tmpnam() } while ($tmp ~~ @names);
|
||||||
$tmp
|
$tmp
|
||||||
}
|
}
|
||||||
|
|
||||||
my $tmp = get_unused_workspace();
|
my $tmp = get_unused_workspace();
|
||||||
|
Loading…
Reference in New Issue
Block a user