return $time_diff>$INPUT_IDLE;
}
+sub mplayer_running()
+{
+ local *F;
+ open F,"/proc/net/unix" or die;
+ my %unix;
+ <F>;
+ while (<F>) {
+ /^(?:\S+\s+){6}(\d+)\s/ or die;
+ $unix{$1}=1;
+ }
+ close F or die;
+
+ local $_;
+ while (</proc/*/exe>) {
+ (my $fdname=$_)=~s{/exe$}{/fd};
+ $_=readlink or next;
+ m{/mplayer$} or next;
+ while (<$fdname/*>) {
+ $_=readlink or next;
+ my $inode=/^\Qsocket:[\E(\d+)\Q]\E$/ or next;
+ return 1 if $unix{$1};
+ }
+ }
+ return;
+}
+
for (;;) {
local *F;
open F,"/proc/net/dev" or die;
$on_now=0 if ($rx-$rx_last) > $RX_THRESHOLD;
$on_now=0 if ($tx-$tx_last) > $TX_THRESHOLD;
}
- $on_now=1 if my $input_idle=input_idle();
+ my $input_idle=input_idle();
+ my $mplayer_running=mplayer_running() if $input_idle;
+ $on_now=1 if $input_idle && !$mplayer_running;
$rx_last=$rx;
$tx_last=$tx;
push @history,$on_now;
my $print=$on_now;
$print=($on_now ? "." : "v") if $input_idle;
+ $print="M" if $mplayer_running;
$print="*" if $ignore_read;
print($print);
- history(1,($input_idle ? 0 : $STABILIZE_ON));
+ history(1,($input_idle && !$mplayer_running ? 0 : $STABILIZE_ON));
history(0,$STABILIZE_OFF);
$ignore_read=$ignore_write;
$ignore_write=0;