Apply a patch provided on PerlMonks.org by lamprecht

http://www.perlmonks.com/?node_id=799099
Fix 2 errors that randomly freeze KDE.

Fix for the 'uninitialized value $args{"-type"} in lc at line 528' and the same for $args{"-mode"}.
Factor out the Focus tests.