Ich habe uebrigens dieses allgemeine Alarm-Skript zum Piepen (bitte den Code entschuldigen, er stand urspruenglich aus perl4-Zeiten :-)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/usr/bin/env perl
$beeps=$count=3;
$from=80;
$to=440;
$step=30;
for ($i = 0; $i <= $#ARGV; ++$i) {
$_ = $ARGV[$i];
ARGL:
{ /^0$/ && exit 0;
/^\d+/ && do { $count = $_; last ARGL; };
/^-nice(up|on)$/ && do { $niceup = 1; last ARGL; };
/^-nice(down|off)$/ && do { $nicedown = 1; last ARGL; };
/^-from$/ && do { $from = $ARGV[++$i]; last ARGL; };
/^-to$/ && do { $to = $ARGV[++$i]; last ARGL; };
/^-step$/ && do { $step = $ARGV[++$i]; last ARGL; };
print "usage: $0 [-niceup|-niceon] [-nicedown|-niceoff] [num_of_beeps]
default number of beeps: $beeps
by Slaven Rezic (eserte\@cs.tu-berlin.de), 14-05-1993
";
exit 0;
}
}
$count = $beeps if !defined $count;
eval '
sub try_x11_beep {
use X11::Protocol;
my $x = new X11::Protocol;
die "Does not work well with VNC"
if ($x->{"vendor"} =~ /AT&T Laboratories Cambridge/ ||
$x->{"vendor"} =~ /The Olivetti & Oracle Research Laboratory/);
my %old_settings = $x->GetKeyboardControl;
my $test;
if ($nicedown) {
($to, $from) = ($from, $to);
$step = -$step;
$test = sub { $_[0] >= $to };
} else {
$test = sub { $_[0] <= $to };
}
for(my $pitch=$from; $test->($pitch); $pitch+=$step) {
$x->ChangeKeyboardControl(bell_pitch => $pitch,
bell_percent => 50);
$x->Bell(10);
select(undef,undef,undef,0.05);
}
$x->ChangeKeyboardControl(bell_percent => $old_settings{bell_percent},
bell_pitch => $old_settings{bell_pitch},
bell_duration => $old_settings{bell_duration},
);
}
';
#warn $@ if $@;
if ($niceup || $nicedown) {
eval 'try_x11_beep()';
exit(0) if (!$@);
#warn $@ if $@;
$count = $beeps;
}
$| = 1; # flush output
for($i=0; $i<$count; $i++) {
print "\a";
select(undef, undef, undef, 0.2); # sleep 0.2 secs
}
Mit
alarm -niceup oder
alarm -nicedown wird die Tonerzeugung mit dem X11-Beep gemacht.