use X11::Protocol; my $x = X11::Protocol->new(); print $x->{screens}->[0]->{width_in_pixels} . ' x ' . $x->{screens}->[0]->{height_in_pixels} . "\n";