Dans le man xscreensaver-command, y'a un exemple en perl... ça tombe bien non ?
#!/usr/bin/perl
my $blanked = 0;
open (IN, "xscreensaver-command -watch |");
while () {
if (m/^(BLANK|LOCK)/) {
if (!$blanked) {
system "sound-off";
$blanked = 1;
}
} elsif (m/^UNBLANK/) {
system "sound-on";
$blanked = 0;
}
}
Note : les balises <pre></pre> rajoutent des lignes blanches entre chaques lignes....
# Re: Evénements clavier/souris
Posté par Matthieu . En réponse au journal Evénements clavier/souris. Évalué à 1.
#!/usr/bin/perl
my $blanked = 0;
open (IN, "xscreensaver-command -watch |");
while () {
if (m/^(BLANK|LOCK)/) {
if (!$blanked) {
system "sound-off";
$blanked = 1;
}
} elsif (m/^UNBLANK/) {
system "sound-on";
$blanked = 0;
}
}
Note : les balises <pre></pre> rajoutent des lignes blanches entre chaques lignes....