mirror of
https://github.com/duncs/clusterssh.git
synced 2025-07-03 01:43:25 +00:00
added support for specifying the desired number of columns or rows
This commit is contained in:
parent
2b9b8990b7
commit
cd355f965d
4 changed files with 58 additions and 18 deletions
|
@ -950,24 +950,43 @@ sub retile_hosts {
|
|||
$self->config->{internal_screen_width} = $xdisplay->{width_in_pixels};
|
||||
|
||||
# Now, work out how many columns of terminals we can fit on screen
|
||||
$self->config->{internal_columns} = int(
|
||||
( $self->config->{internal_screen_width}
|
||||
- $self->config->{screen_reserve_left}
|
||||
- $self->config->{screen_reserve_right}
|
||||
) / (
|
||||
$self->config->{internal_terminal_width}
|
||||
+ $self->config->{terminal_reserve_left}
|
||||
+ $self->config->{terminal_reserve_right}
|
||||
)
|
||||
);
|
||||
|
||||
# Work out the number of rows we need to use to fit everything on screen
|
||||
$self->config->{internal_rows} = int(
|
||||
( $self->config->{internal_total}
|
||||
/ $self->config->{internal_columns}
|
||||
) + 0.999
|
||||
);
|
||||
if ( $self->config->{rows} != -1 || $self->config->{cols} != -1 ) {
|
||||
if ( $self->config->{rows} != -1 ) {
|
||||
$self->config->{internal_rows} = $self->config->{rows};
|
||||
$self->config->{internal_columns} = int(
|
||||
( $self->config->{internal_total}
|
||||
/ $self->config->{internal_rows}
|
||||
) + 0.999
|
||||
);
|
||||
}
|
||||
else {
|
||||
$self->config->{internal_columns} = $self->config->{cols};
|
||||
$self->config->{internal_rows} = int(
|
||||
( $self->config->{internal_total}
|
||||
/ $self->config->{internal_columns}
|
||||
) + 0.999
|
||||
);
|
||||
}
|
||||
}
|
||||
else {
|
||||
$self->config->{internal_columns} = int(
|
||||
( $self->config->{internal_screen_width}
|
||||
- $self->config->{screen_reserve_left}
|
||||
- $self->config->{screen_reserve_right}
|
||||
) / (
|
||||
$self->config->{internal_terminal_width}
|
||||
+ $self->config->{terminal_reserve_left}
|
||||
+ $self->config->{terminal_reserve_right}
|
||||
)
|
||||
);
|
||||
|
||||
# Work out the number of rows we need to use to fit everything on screen
|
||||
$self->config->{internal_rows} = int(
|
||||
( $self->config->{internal_total}
|
||||
/ $self->config->{internal_columns}
|
||||
) + 0.999
|
||||
);
|
||||
}
|
||||
$self->debug( 2, "Screen Columns: ", $self->config->{internal_columns} );
|
||||
$self->debug( 2, "Screen Rows: ", $self->config->{internal_rows} );
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue