mirror of
https://github.com/duncs/clusterssh.git
synced 2025-07-03 09:53:23 +00:00
Merge branch 'master' of https://github.com/AsharLohmar/clusterssh into AsharLohmar-master
This commit is contained in:
commit
df96d66150
4 changed files with 104 additions and 21 deletions
|
@ -950,30 +950,50 @@ sub retile_hosts {
|
||||||
$self->config->{internal_screen_width} = $xdisplay->{width_in_pixels};
|
$self->config->{internal_screen_width} = $xdisplay->{width_in_pixels};
|
||||||
|
|
||||||
# Now, work out how many columns of terminals we can fit on screen
|
# Now, work out how many columns of terminals we can fit on screen
|
||||||
$self->config->{internal_columns} = int(
|
if ( $self->config->{rows} != -1 || $self->config->{cols} != -1 ) {
|
||||||
( $self->config->{internal_screen_width}
|
if ( $self->config->{rows} != -1 ) {
|
||||||
- $self->config->{screen_reserve_left}
|
$self->config->{internal_rows} = $self->config->{rows};
|
||||||
- $self->config->{screen_reserve_right}
|
$self->config->{internal_columns} = int(
|
||||||
) / (
|
( $self->config->{internal_total}
|
||||||
$self->config->{internal_terminal_width}
|
/ $self->config->{internal_rows}
|
||||||
+ $self->config->{terminal_reserve_left}
|
) + 0.999
|
||||||
+ $self->config->{terminal_reserve_right}
|
);
|
||||||
)
|
}
|
||||||
);
|
else {
|
||||||
|
$self->config->{internal_columns} = $self->config->{cols};
|
||||||
# Work out the number of rows we need to use to fit everything on screen
|
$self->config->{internal_rows} = int(
|
||||||
$self->config->{internal_rows} = int(
|
( $self->config->{internal_total}
|
||||||
( $self->config->{internal_total}
|
/ $self->config->{internal_columns}
|
||||||
/ $self->config->{internal_columns}
|
) + 0.999
|
||||||
) + 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 Columns: ", $self->config->{internal_columns} );
|
||||||
$self->debug( 2, "Screen Rows: ", $self->config->{internal_rows} );
|
$self->debug( 2, "Screen Rows: ", $self->config->{internal_rows} );
|
||||||
|
$self->debug( 2, "Fill scree: ", $self->config->{fillscreen} );
|
||||||
|
|
||||||
# Now adjust the height of the terminal to either the max given,
|
# Now adjust the height of the terminal to either the max given,
|
||||||
# or to get everything on screen
|
# or to get everything on screen
|
||||||
{
|
if ( $self->config->{fillscreen} ne 'yes' ) {
|
||||||
my $height = int(
|
my $height = int(
|
||||||
( ( $self->config->{internal_screen_height}
|
( ( $self->config->{internal_screen_height}
|
||||||
- $self->config->{screen_reserve_top}
|
- $self->config->{screen_reserve_top}
|
||||||
|
@ -986,15 +1006,41 @@ sub retile_hosts {
|
||||||
)
|
)
|
||||||
) / $self->config->{internal_rows}
|
) / $self->config->{internal_rows}
|
||||||
);
|
);
|
||||||
|
|
||||||
$self->debug( 2, "Terminal height=$height" );
|
|
||||||
|
|
||||||
$self->config->{internal_terminal_height} = (
|
$self->config->{internal_terminal_height} = (
|
||||||
$height > $self->config->{internal_terminal_height}
|
$height > $self->config->{internal_terminal_height}
|
||||||
? $self->config->{internal_terminal_height}
|
? $self->config->{internal_terminal_height}
|
||||||
: $height
|
: $height
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
$self->config->{internal_terminal_height} = int(
|
||||||
|
( ( $self->config->{internal_screen_height}
|
||||||
|
- $self->config->{screen_reserve_top}
|
||||||
|
- $self->config->{screen_reserve_bottom}
|
||||||
|
) - (
|
||||||
|
$self->config->{internal_rows} * (
|
||||||
|
$self->config->{terminal_reserve_top}
|
||||||
|
+ $self->config->{terminal_reserve_bottom}
|
||||||
|
)
|
||||||
|
)
|
||||||
|
) / $self->config->{internal_rows}
|
||||||
|
);
|
||||||
|
$self->config->{internal_terminal_width} = int(
|
||||||
|
( ( $self->config->{internal_screen_width}
|
||||||
|
- $self->config->{screen_reserve_left}
|
||||||
|
- $self->config->{screen_reserve_right}
|
||||||
|
) - (
|
||||||
|
$self->config->{internal_columns} * (
|
||||||
|
$self->config->{terminal_reserve_left}
|
||||||
|
+ $self->config->{terminal_reserve_right}
|
||||||
|
)
|
||||||
|
)
|
||||||
|
) / $self->config->{internal_columns}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
$self->debug( 2, "Terminal h: ",
|
||||||
|
$self->config->{internal_terminal_height},
|
||||||
|
", w: ", $self->config->{internal_terminal_width} );
|
||||||
|
|
||||||
$self->config->dump("noexit") if ( $self->options->debug_level > 1 );
|
$self->config->dump("noexit") if ( $self->options->debug_level > 1 );
|
||||||
|
|
||||||
|
@ -2388,3 +2434,4 @@ See http://dev.perl.org/licenses/ for more information.
|
||||||
=cut
|
=cut
|
||||||
|
|
||||||
1;
|
1;
|
||||||
|
|
||||||
|
|
|
@ -108,6 +108,11 @@ my %default_config = (
|
||||||
|
|
||||||
# don't set username here as takes precendence over ssh config
|
# don't set username here as takes precendence over ssh config
|
||||||
user => '',
|
user => '',
|
||||||
|
rows => -1,
|
||||||
|
cols => -1,
|
||||||
|
|
||||||
|
fillscreen => "no",
|
||||||
|
|
||||||
);
|
);
|
||||||
|
|
||||||
sub new {
|
sub new {
|
||||||
|
|
|
@ -240,6 +240,22 @@ sub add_common_options {
|
||||||
help =>
|
help =>
|
||||||
$self->loc('Do not output extra text when using some options'),
|
$self->loc('Do not output extra text when using some options'),
|
||||||
);
|
);
|
||||||
|
$self->add_option(
|
||||||
|
spec => 'cols|x=i',
|
||||||
|
arg_desc => 'cols',
|
||||||
|
help => $self->loc('Number of columns'),
|
||||||
|
);
|
||||||
|
$self->add_option(
|
||||||
|
spec => 'rows|y=i',
|
||||||
|
arg_desc => 'rows',
|
||||||
|
help => $self->loc('Number of rows'),
|
||||||
|
);
|
||||||
|
|
||||||
|
$self->add_option(
|
||||||
|
spec => 'fillscreen',
|
||||||
|
help => $self->loc(
|
||||||
|
'Resize terminal windows to fill the whole available screen'),
|
||||||
|
);
|
||||||
|
|
||||||
return $self;
|
return $self;
|
||||||
}
|
}
|
||||||
|
@ -380,6 +396,14 @@ sub getopts {
|
||||||
= !$self->parent->config->{window_tiling} || 0;
|
= !$self->parent->config->{window_tiling} || 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( $self->rows ) {
|
||||||
|
$self->parent->config->{rows} = $self->rows;
|
||||||
|
}
|
||||||
|
if ( $self->cols ) {
|
||||||
|
$self->parent->config->{cols} = $self->cols;
|
||||||
|
}
|
||||||
|
$self->parent->config->{fillscreen} = "yes"
|
||||||
|
if ( $self->fillscreen );
|
||||||
return $self;
|
return $self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -124,6 +124,10 @@ Readonly::Hash my %default_config => {
|
||||||
# other bits inheritted from App::ClusterSSH::Base
|
# other bits inheritted from App::ClusterSSH::Base
|
||||||
lang => 'en',
|
lang => 'en',
|
||||||
user => '',
|
user => '',
|
||||||
|
rows => -1,
|
||||||
|
cols => -1,
|
||||||
|
|
||||||
|
fillscreen => 'no',
|
||||||
};
|
};
|
||||||
my %expected = %default_config;
|
my %expected = %default_config;
|
||||||
is_deeply( $config, \%expected, 'default config is correct' );
|
is_deeply( $config, \%expected, 'default config is correct' );
|
||||||
|
@ -538,12 +542,14 @@ my $expected = qq{# Configuration dump produced by "cssh -d"
|
||||||
auto_close=5
|
auto_close=5
|
||||||
auto_quit=yes
|
auto_quit=yes
|
||||||
auto_wm_decoration_offsets=no
|
auto_wm_decoration_offsets=no
|
||||||
|
cols=-1
|
||||||
console=console
|
console=console
|
||||||
console_args=
|
console_args=
|
||||||
console_position=
|
console_position=
|
||||||
external_cluster_command=
|
external_cluster_command=
|
||||||
extra_cluster_file=
|
extra_cluster_file=
|
||||||
extra_tag_file=
|
extra_tag_file=
|
||||||
|
fillscreen=no
|
||||||
hide_menu=0
|
hide_menu=0
|
||||||
history_height=10
|
history_height=10
|
||||||
history_width=40
|
history_width=40
|
||||||
|
@ -568,6 +574,7 @@ max_host_menu_items=30
|
||||||
menu_host_autotearoff=0
|
menu_host_autotearoff=0
|
||||||
menu_send_autotearoff=0
|
menu_send_autotearoff=0
|
||||||
mouse_paste=Button-2
|
mouse_paste=Button-2
|
||||||
|
rows=-1
|
||||||
rsh=rsh
|
rsh=rsh
|
||||||
rsh_args=
|
rsh_args=
|
||||||
screen_reserve_bottom=60
|
screen_reserve_bottom=60
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue