#!/bin/sh # # xonjointdisplau - the geometry of the largest display horiz. across screens # # $Id$ margin=25 Die() { echo fatal error: $@ 1>&2; exit 1; } DieIfMissing() { for x in "$@" do command -v "$x" >/dev/null || Die cannot find required executable $x done } DieIfMissing sort xdisplaygeometries xdisplaygeometries | grep -q . || Die cannot find any screens to use xdisplaygeometries | perl -lnwe ' BEGIN { my %g; }; my ($w,$h,$r,$t) = /^(\d+)x(\d+)\+(\d+)\+(\d+)/ or next; $g{$r}{h} = $h; $g{$r}{w} = $w; END { my ($ww,$hh) = (0,0); for (my $r = 0; defined $g{$r}; $r += $g{$r}{w}) { $ww += $g{$r}{w}; $hh = $g{$r}{h} if ($hh == 0 || $g{$r}{h} < $hh); } printf("%dx%d+0+0\n", $ww-'$margin', $hh-'$margin') }'