… | |
… | |
98 | Argument names also often indicate the type of a parameter. Here are |
98 | Argument names also often indicate the type of a parameter. Here are |
99 | some hints on what they mean: |
99 | some hints on what they mean: |
100 | |
100 | |
101 | $text |
101 | $text |
102 | Rxvt-unicodes special way of encoding text, where one "unicode" |
102 | Rxvt-unicodes special way of encoding text, where one "unicode" |
103 | character always represents one screen cell. See row_t for a |
103 | character always represents one screen cell. See ROW_t for a |
104 | discussion of this format. |
104 | discussion of this format. |
105 | |
105 | |
106 | $string |
106 | $string |
107 | A perl text string, with an emphasis on *text*. It can store all |
107 | A perl text string, with an emphasis on *text*. It can store all |
108 | unicode characters and is to be distinguished with text encoded in a |
108 | unicode characters and is to be distinguished with text encoded in a |
… | |
… | |
299 | |
299 | |
300 | $urxvt::TERM |
300 | $urxvt::TERM |
301 | The current terminal. This variable stores the current "urxvt::term" |
301 | The current terminal. This variable stores the current "urxvt::term" |
302 | object, whenever a callback/hook is executing. |
302 | object, whenever a callback/hook is executing. |
303 | |
303 | |
304 | * |
|
|
305 | |
|
|
306 | Functions in the "urxvt" Package |
304 | Functions in the "urxvt" Package |
307 | urxvt::fatal $errormessage |
305 | urxvt::fatal $errormessage |
308 | Fatally aborts execution with the given error message. Avoid at all |
306 | Fatally aborts execution with the given error message. Avoid at all |
309 | costs! The only time this is acceptable is when the terminal process |
307 | costs! The only time this is acceptable is when the terminal process |
310 | starts up. |
308 | starts up. |
… | |
… | |
382 | |
380 | |
383 | The "urxvt::term" Class |
381 | The "urxvt::term" Class |
384 | $term = new urxvt::term $envhashref, $rxvtname, [arg...] |
382 | $term = new urxvt::term $envhashref, $rxvtname, [arg...] |
385 | Creates a new terminal, very similar as if you had started it with |
383 | Creates a new terminal, very similar as if you had started it with |
386 | system "$rxvtname, arg...". $envhashref must be a reference to a |
384 | system "$rxvtname, arg...". $envhashref must be a reference to a |
387 | %ENV>-like "hash which defines the environment of the new terminal. |
385 | %ENV-like hash which defines the environment of the new terminal. |
388 | " |
|
|
389 | |
386 | |
390 | >Croaks (and probably outputs an error message) if the new instance |
387 | Croaks (and probably outputs an error message) if the new instance |
391 | couldn't be created. Returns "undef" if the new instance didn't |
388 | couldn't be created. Returns "undef" if the new instance didn't |
392 | initialise perl, and the terminal object otherwise. The "init" and |
389 | initialise perl, and the terminal object otherwise. The "init" and |
393 | "start" hooks will be called during this call. |
390 | "start" hooks will be called during this call. |
394 | |
391 | |
395 | $term->destroy |
392 | $term->destroy |
… | |
… | |
736 | |
733 | |
737 | $popup->show |
734 | $popup->show |
738 | Displays the popup (which is initially hidden). |
735 | Displays the popup (which is initially hidden). |
739 | |
736 | |
740 | The "urxvt::timer" Class |
737 | The "urxvt::timer" Class |
741 | This class implements timer watchers/events. Time is represented as |
738 | This class implements timer watchers/events. Time is represented as a |
742 | a fractional number of seconds since the epoch. Example: |
739 | fractional number of seconds since the epoch. Example: |
743 | |
740 | |
744 | $term->{overlay} = $term->overlay (-1, 0, 8, 1, urxvt::OVERLAY_RSTYLE, 0); |
741 | $term->{overlay} = $term->overlay (-1, 0, 8, 1, urxvt::OVERLAY_RSTYLE, 0); |
745 | $term->{timer} = urxvt::timer |
742 | $term->{timer} = urxvt::timer |
746 | ->new |
743 | ->new |
747 | ->interval (1) |
744 | ->interval (1) |
748 | ->cb (sub { |
745 | ->cb (sub { |
749 | $term->{overlay}->set (0, 0, |
746 | $term->{overlay}->set (0, 0, |
750 | sprintf "%2d:%02d:%02d", (localtime urxvt::NOW)[2,1,0]); |
747 | sprintf "%2d:%02d:%02d", (localtime urxvt::NOW)[2,1,0]); |
751 | }); |
748 | }); |
752 | |
749 | |
753 | $timer = new urxvt::timer |
750 | $timer = new urxvt::timer |
754 | Create a new timer object in started state. It is scheduled to |
751 | Create a new timer object in started state. It is scheduled to fire |
755 | fire immediately. |
752 | immediately. |
756 | |
753 | |
757 | $timer = $timer->cb (sub { my ($timer) = @_; ... }) |
754 | $timer = $timer->cb (sub { my ($timer) = @_; ... }) |
758 | Set the callback to be called when the timer triggers. |
755 | Set the callback to be called when the timer triggers. |
759 | |
756 | |
760 | $tstamp = $timer->at |
757 | $tstamp = $timer->at |
761 | Return the time this watcher will fire next. |
758 | Return the time this watcher will fire next. |
762 | |
759 | |
763 | $timer = $timer->set ($tstamp) |
760 | $timer = $timer->set ($tstamp) |
764 | Set the time the event is generated to $tstamp. |
761 | Set the time the event is generated to $tstamp. |
765 | |
762 | |
766 | $timer = $timer->interval ($interval) |
763 | $timer = $timer->interval ($interval) |
767 | Normally (and when $interval is 0), the timer will automatically |
764 | Normally (and when $interval is 0), the timer will automatically |
768 | stop after it has fired once. If $interval is non-zero, then the |
765 | stop after it has fired once. If $interval is non-zero, then the |
769 | timer is automatically rescheduled at the given intervals. |
766 | timer is automatically rescheduled at the given intervals. |
770 | |
767 | |
771 | $timer = $timer->start |
768 | $timer = $timer->start |
772 | Start the timer. |
769 | Start the timer. |
773 | |
770 | |
774 | $timer = $timer->start ($tstamp) |
771 | $timer = $timer->start ($tstamp) |
775 | Set the event trigger time to $tstamp and start the timer. |
772 | Set the event trigger time to $tstamp and start the timer. |
776 | |
773 | |
777 | $timer = $timer->stop |
774 | $timer = $timer->stop |
778 | Stop the timer. |
775 | Stop the timer. |
779 | |
776 | |
780 | The "urxvt::iow" Class |
777 | The "urxvt::iow" Class |
781 | This class implements io watchers/events. Example: |
778 | This class implements io watchers/events. Example: |
782 | |
779 | |
783 | $term->{socket} = ... |
780 | $term->{socket} = ... |
784 | $term->{iow} = urxvt::iow |
781 | $term->{iow} = urxvt::iow |
785 | ->new |
782 | ->new |
786 | ->fd (fileno $term->{socket}) |
783 | ->fd (fileno $term->{socket}) |
787 | ->events (urxvt::EVENT_READ) |
784 | ->events (urxvt::EVENT_READ) |
788 | ->start |
785 | ->start |
789 | ->cb (sub { |
786 | ->cb (sub { |
790 | my ($iow, $revents) = @_; |
787 | my ($iow, $revents) = @_; |
791 | # $revents must be 1 here, no need to check |
788 | # $revents must be 1 here, no need to check |
792 | sysread $term->{socket}, my $buf, 8192 |
789 | sysread $term->{socket}, my $buf, 8192 |
793 | or end-of-file; |
790 | or end-of-file; |
794 | }); |
791 | }); |
795 | |
792 | |
796 | $iow = new urxvt::iow |
793 | $iow = new urxvt::iow |
797 | Create a new io watcher object in stopped state. |
794 | Create a new io watcher object in stopped state. |
798 | |
795 | |
799 | $iow = $iow->cb (sub { my ($iow, $reventmask) = @_; ... }) |
796 | $iow = $iow->cb (sub { my ($iow, $reventmask) = @_; ... }) |
800 | Set the callback to be called when io events are triggered. |
797 | Set the callback to be called when io events are triggered. |
801 | $reventmask is a bitset as described in the "events" method. |
798 | $reventmask is a bitset as described in the "events" method. |
802 | |
799 | |
803 | $iow = $iow->fd ($fd) |
800 | $iow = $iow->fd ($fd) |
804 | Set the filedescriptor (not handle) to watch. |
801 | Set the filedescriptor (not handle) to watch. |
805 | |
802 | |
806 | $iow = $iow->events ($eventmask) |
803 | $iow = $iow->events ($eventmask) |
807 | Set the event mask to watch. The only allowed values are |
804 | Set the event mask to watch. The only allowed values are |
808 | "urxvt::EVENT_READ" and "urxvt::EVENT_WRITE", which might be |
805 | "urxvt::EVENT_READ" and "urxvt::EVENT_WRITE", which might be ORed |
809 | ORed together, or "urxvt::EVENT_NONE". |
806 | together, or "urxvt::EVENT_NONE". |
810 | |
807 | |
811 | $iow = $iow->start |
808 | $iow = $iow->start |
812 | Start watching for requested events on the given handle. |
809 | Start watching for requested events on the given handle. |
813 | |
810 | |
814 | $iow = $iow->stop |
811 | $iow = $iow->stop |
815 | Stop watching for events on the given filehandle. |
812 | Stop watching for events on the given filehandle. |
816 | |
813 | |
817 | ENVIRONMENT |
814 | ENVIRONMENT |
818 | URXVT_PERL_VERBOSITY |
815 | URXVT_PERL_VERBOSITY |
819 | This variable controls the verbosity level of the perl extension. |
816 | This variable controls the verbosity level of the perl extension. Higher |
820 | Higher numbers indicate more verbose output. |
817 | numbers indicate more verbose output. |
821 | |
818 | |
822 | == 0 - fatal messages |
819 | == 0 - fatal messages |
823 | >= 3 - script loading and management |
820 | >= 3 - script loading and management |
824 | >=10 - all events received |
821 | >=10 - all events received |
825 | |
822 | |
826 | AUTHOR |
823 | AUTHOR |
827 | Marc Lehmann <pcg@goof.com> |
824 | Marc Lehmann <pcg@goof.com> |
828 | http://software.schmorp.de/pkg/rxvt-unicode |
825 | http://software.schmorp.de/pkg/rxvt-unicode |
829 | |
826 | |