Created
December 31, 2014 14:16
-
-
Save scorpp/8da0bdcd61f63fb77d99 to your computer and use it in GitHub Desktop.
Skype: focus main win and prepare it for typing in contact name
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use strict; | |
use warnings; | |
use Net::DBus; | |
my $session = Net::DBus->session; | |
my $service = $session->get_service('com.Skype.API'); | |
my $skype = $service->get_object('/com/Skype'); | |
$skype->Invoke('NAME PerlMuteScript') eq 'OK' | |
or die 'Cannot connect to skype'; | |
$skype->Invoke('PROTOCOL 5') eq 'PROTOCOL 5' | |
or die 'Cannot agree protocol'; | |
print $skype->Invoke('OPEN CONTACTS') . "\n"; | |
# sometimes it fails to activate window from first time properly | |
system('sh', '-c', 'xdotool search Skype™ | sort | head -n1 | xargs -i xdotool windowactivate --sync {} key Escape'); | |
system('sh', '-c', 'xdotool search Skype™ | sort | head -n1 | xargs -i xdotool windowactivate --sync {} key Escape'); | |
exit 0; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment