#! /usr/bin/perl -w

# Waider 05/10/2002
# Caution: cheese
# This is based on Tom Boutell's WebLater tool, and also on an idea
# mentioned in my Ideal Computer spiel.
package Monitor::WebLater;

use Monitor;
@ISA = "Monitor";

sub newdata {
  my $mon = shift;
  my $text = "";

  # The horror, the horror.
  # This could and should be done with X; register for SelectionNotify events or something.
  open( CUTSEL, "xprop -root | grep ^CUT_BUFFER |" ) or die $!;
  my @buffers = <CUTSEL>;
  # Now look for URLs.
  for my $buf ( @buffers ) {
	$buf =~ s<^.*?= "(.*)"$><$1>;
	if ( $buf =~ /http/i ) {
	  $text .= $buf;
	}
  }

  $text;
}
