#!/usr/bin/perl use warnings; use strict; use Tk; my $mw = MainWindow->new; #my $width = $mw->screenwidth; #my $height = $mw->screenheight; #$mw->geometry($width . 'x' . $height .'+0+0'); $mw->bind('', [\&activity ,'mouse']); $mw->bind('', [ \&activity, Ev('K')]); $mw->after(500,sub {$mw->grabGlobal}); #window must be visible $mw->focusForce; #for grab MainLoop; sub activity { if( $_[1] eq 'Escape'){ exit } print chr(07); #beep }