Allow terminal positioning algorithm to be configurable

Previous change "Take into account WM decorations when tiling (Github pull
request #66) (thanks to Andrew Stevenson)" has caused problems on some
systems but improved tiling on others, so make the algorithm configurable
to use the original one (default) or the new style.

To be revisited when all the window handling code is moved into a separate
module
This commit is contained in:
Duncan Ferguson 2017-03-07 22:01:27 +00:00
parent b9a42101f1
commit 4266c2a06e
5 changed files with 30 additions and 10 deletions

View file

@ -1001,18 +1001,26 @@ sub retile_hosts {
# now find the size of the window decorations
if ( !exists( $self->config->{internal_terminal_wm_decoration_left} ) ) {
# use the first window as exemplary
my ($wid) = $servers{ ( keys(%servers) )[0] }{wid};
# Debian #842965 (https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=842965)
# disable behavior added in https://github.com/duncs/clusterssh/pull/66
# unless explicitly enabled with auto_wm_decoration_offsets => yes
if ( defined($wid) ) {
if ( $self->config->{auto_wm_decoration_offsets} =~ /yes/i ) {
# get the WM decoration sizes
( $self->config->{internal_terminal_wm_decoration_left},
$self->config->{internal_terminal_wm_decoration_right},
$self->config->{internal_terminal_wm_decoration_top},
$self->config->{internal_terminal_wm_decoration_bottom}
)
= X11::Protocol::WM::get_net_frame_extents( $xdisplay, $wid );
# use the first window as exemplary
my ($wid) = $servers{ ( keys(%servers) )[0] }{wid};
if ( defined($wid) ) {
# get the WM decoration sizes
( $self->config->{internal_terminal_wm_decoration_left},
$self->config->{internal_terminal_wm_decoration_right},
$self->config->{internal_terminal_wm_decoration_top},
$self->config->{internal_terminal_wm_decoration_bottom}
)
= X11::Protocol::WM::get_net_frame_extents( $xdisplay,
$wid );
}
}
# in case the WM call failed we set some defaults

View file

@ -104,6 +104,8 @@ my %default_config = (
send_menu_xml_file => $ENV{HOME} . '/.clusterssh/send_menu',
auto_wm_decoration_offsets => "no", # Debian #842965
# don't set username here as takes precendence over ssh config
user => '',
);

View file

@ -633,6 +633,11 @@ would replace the <Alt-n> with the client's name in each window.}
'L<--autoquit>',
);
output '=item auto_wm_decoration_offsets = no';
output $self->loc(
'Enable or disable alternative algorithm for calculating terminal positioning.',
);
output '=item comms = ' . $self->parent->config->{comms};
output $self->loc(
'Sets the default communication method (initially taken from the name of the program, but can be overridden here).'