#!perl
# PODNAME: tmuxlayout
use strict;
use autodie;
use Carp;
# ABSTRACT: Configure and reconfigure tmux layouts easily
MAIN: {
if ( scalar(@ARGV) < 1 ) {
while (<STDIN>) { push @ARGV, $_; }
}
my $layout = Term::Tmux::Layout->new();
$layout->set_layout(@ARGV);
}
# VIM Modeline below - signals that this file is Perl code.
# vim: ft=perl
__END__
=pod
=encoding UTF-8
=head1 NAME
tmuxlayout - Configure and reconfigure tmux layouts easily
=head1 VERSION
version 1.182060
=head1 SYNOPSIS
tmuxlayout abc def def # Creates a layout of 3 columns and two rows,
# with the bottom row being twice as high as
# the top row
=head1 DESCRIPTION
This utility takes a "layout" in a text format, and signals the current
tmux window to use this new layout.
The layout format consists of a text field of numbers or other
characters, separated by new lines. Each character reflects a
single pane on the screen, defining its size in rows and
columns.
Some sample layouts:
11123
11124
This would create a layout with 4 panes. The panes would be
arranged such that pane 1 takes up the entire vertical canvas,
but only 3/5ths of the horizontal canvas. Pane 2 also takes up
the entire vertical canvas, but only 1/5 of the horizontal
canvas. Pane 3 and 4 are stacked, taking 1/5 of the horizontal
canvas, evenly splitting the vertical canvas.
Note that some layouts cannot be displayed by tmux. For example,
the following would be invalid:
1122
1134
5556
Tmux divides the entire screen up either horizontally or vertically.
However, there is no single horizontal or vertical split that would
allow this screen to be divided.
This layout can be passed a single argument, where the rows are
seperated by pipe characters C<|> or new lines embedded in the
argument.
If this utility is passed an multiple arguments, each argument
starts its own row. Each element can also contain pipe or newlines,
and these are also interpreted as row deliminators.
Finally, if no arguments are passed, this utility will instead read
from C<STDIN>, with each line being treated as a row (in addition,
each line input can be split instead with embedded pipe characters).
Thus, the following are all valid ways of calling C<tmuxlayout>:
tmuxlayout 'abc|def|ghi'
tmuxlayout "abc
def
ghi"
tmuxlayout 'abc', 'def', 'ghi';
tmuxlayout 'abc|def', 'ghi';
echo 'abc|def' | tmuxlayout
=head1 REPOSITORY
=head1 SEE ALSO
See L<Term::Tmux::Layout> for more details about the underlying module used
by this application.
=head1 BUGS
Check the issue tracker at:
=head1 AUTHOR
Joelle Maslak <jmaslak@antelope.net>
=head1 COPYRIGHT AND LICENSE
This software is copyright (c) 2015-2018 by Joelle Maslak.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
=cut