Skip to content

Commit

Permalink
Fix calculations for halfscreen height
Browse files Browse the repository at this point in the history
Also add a few comments to clarify the logic
  • Loading branch information
Charles Hogg committed Jan 24, 2013
1 parent fe78170 commit b6fa680
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions halfscreen
Expand Up @@ -7,13 +7,20 @@ use Switch;

my $dgCmd = "$ENV{'HOME'}/bin/desktop_geometry 2> /dev/null";
my ($width, $height) = split/,/, `$dgCmd`;

# Exclude area occupied by the bottom bar in fluxbox from calculations.
$height -= $ARGV[1] if ($ARGV[1] =~ /^\d+$/);

# Compute sizes and boundaries.
my $Hwidth = int($width / 2) - 1;
my $Hheight = int($height / 2) - 1;
my $left = $Hwidth + 1;
my $top = $Hheight + 1;
my $titlebar = ($ARGV[2] =~ /^\d+$/ ? $ARGV[2] : 0);

# Compensate for titlebar height.
$Hheight -= $titlebar;
$height -= $titlebar;

$do_it = 1;
switch ($ARGV[0]) {
Expand Down

0 comments on commit b6fa680

Please sign in to comment.