Created
July 24, 2012 07:52
-
-
Save theist/3168670 to your computer and use it in GitHub Desktop.
Hamster activity print
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 -w | |
# | |
use strict; | |
use Net::DBus; | |
eval { | |
my $bus = Net::DBus->find; | |
my $hamster = $bus->get_service("org.gnome.Hamster"); | |
my $hamster_manager = $hamster->get_object("/org/gnome/Hamster","org.gnome.Hamster"); | |
my $acct = $hamster_manager->GetCurrentActivity(); | |
if ($acct) { | |
print "$acct\n"; | |
} else { | |
print "No Activity\n"; | |
} | |
}; | |
print "Hamster not present\n" if ($@); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment