From cb7bb36d18997ed790e9c03980a2cedcaf9dbeb5 Mon Sep 17 00:00:00 2001 From: root Date: Mon, 2 Jan 2006 20:47:52 +0000 Subject: [PATCH] *** empty log message *** --- src/Makefile.in | 2 +- src/perl/simple-overlay-clock | 20 ++++++++++++++++++++ src/urxvt.pm | 14 ++++++++------ 3 files changed, 29 insertions(+), 7 deletions(-) create mode 100644 src/perl/simple-overlay-clock diff --git a/src/Makefile.in b/src/Makefile.in index 893163e8..41aa1e2a 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -98,7 +98,7 @@ install-perl: @IF_PERL@ $(INSTALL) -d $(DESTDIR)$(libdir)/urxvt @IF_PERL@ $(INSTALL) -d $(DESTDIR)$(libdir)/urxvt/perl @IF_PERL@ $(INSTALL_DATA) urxvt.pm $(DESTDIR)$(libdir)/urxvt/urxvt.pm -@IF_PERL@ for ext in perl/*; do test -f "$$ext" && $(INSTALL_DATA) "$$ext" $(DESTDIR)$(libdir)/urxvt/"$$ext"; done +@IF_PERL@ -for ext in perl/*; do test -f "$$ext" && $(INSTALL_DATA) "$$ext" $(DESTDIR)$(libdir)/urxvt/"$$ext"; done install: allbin alldoc install-perl $(INSTALL) -d $(DESTDIR)$(bindir) diff --git a/src/perl/simple-overlay-clock b/src/perl/simple-overlay-clock new file mode 100644 index 00000000..93764fee --- /dev/null +++ b/src/perl/simple-overlay-clock @@ -0,0 +1,20 @@ +#! perl + +use POSIX (); + +sub on_init { + my ($self) = @_; + + $self->{timer} = urxvt::timer + ->new + ->start (urxvt::NOW) + ->cb (sub { + my ($timer) = @_; + my $time = $timer->at; + $timer->start ($time + 1); + $self->scr_overlay (-1, 0, POSIX::strftime "%H:%M:%S", localtime $time); + }); + + () +} + diff --git a/src/urxvt.pm b/src/urxvt.pm index 656e2574..34f7d5ae 100644 --- a/src/urxvt.pm +++ b/src/urxvt.pm @@ -4,22 +4,24 @@ rxvtperl - rxvt-unicode's embedded perl interpreter =head1 SYNOPSIS -* Put your scripts into F<@@RXVT_LIBDIR@@/urxvt/perl/>, they will be loaded automatically. - -* Scripts are evaluated in a 'use strict' and 'use utf8' environment, and -thus must be encoded as UTF-8. + # create a file grab_test in $HOME: sub on_sel_grab { warn "you selected ", $_[0]->selection; () } - 1 + # start a @@RXVT_NAME@@ using it: + + @@RXVT_NAME@@ --perl-lib $HOME -pe grab_test =head1 DESCRIPTION Everytime a terminal object gets created, scripts specified via the -C resource are associated with it. +C resource are loaded and associated with it. + +Scripts are compiled in a 'use strict' and 'use utf8' environment, and +thus must be encoded as UTF-8. Each script will only ever be loaded once, even in @@RXVT_NAME@@d, where scripts will be shared (But not enabled) for all terminals. -- 2.34.1