#! perl # ziconbeep - output while iconified causes bell and "***" as icon prefix my $marker = "*** "; my $string; my $utf8_string; my $wmiconname; my $netwmiconname; sub on_init { my $self = shift; $string = $self->XInternAtom("STRING"); $utf8_string = $self->XInternAtom("UTF8_STRING"); $wmiconname = $self->XInternAtom("WM_ICON_NAME"); $netwmiconname = $self->XInternAtom("_NET_WM_ICON_NAME"); } my $oldtitle; sub set_title { my ($self, $title) = @_; if ($title ne $oldtitle) { $self->XChangeProperty($self->parent, $wmiconname, $string, 8, $title); $self->XChangeProperty($self->parent, $netwmiconname, $utf8_string, 8, $title); } $oldtitle = $title; } sub get_title { my $self = shift; my ($type, $format, $items) = $self->XGetWindowProperty($self->parent, $netwmiconname); $items } sub on_line_update { my ($self, $row) = @_; if (!$self->mapped) { my $title = get_title($self); $title = $marker . $title unless ($title =~ /^\Q$marker/); set_title($self, $title); $self->scr_bell(); } () } sub on_map_notify { my $self = shift; my $title = get_title($self); $title =~ s/^\Q$marker//; set_title($self, $title); () }