xrefresh
#!/usr/bin/perl
use strict;
use warnings;
use X11::GUITest
qw/GetInputFocus SetInputFocus FindWindowLike WaitWindowViewable SendKeys/;
my $title = $ARGV[0] || 'Firefox';
my $command = $ARGV[1] || '^(r)';
my $curwin = GetInputFocus();
my ($win) = FindWindowLike($title)
or die "Couldn't find window $title";
SetInputFocus($win) or die "couldn't set input to $win";
## WaitWindowViewable( $title, 2 ) or die "Couldn't find $title";
## sleep 1;
SendKeys($command) or die "couldn't send keys";
## sleep 1;
SetInputFocus($curwin) or die "couldn't return to $curwin";