… | |
… | |
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 | $term = new urxvt [arg...] |
|
|
308 | Creates a new terminal, very similar as if you had started it with |
|
|
309 | "system $binfile, arg...". Croaks (and probably outputs an error |
|
|
310 | message) if the new instance couldn't be created. Returns "undef" if |
|
|
311 | the new instance didn't initialise perl, and the terminal object |
|
|
312 | otherwise. The "init" and "start" hooks will be called during the |
|
|
313 | call. |
|
|
314 | |
|
|
315 | urxvt::fatal $errormessage |
305 | urxvt::fatal $errormessage |
316 | Fatally aborts execution with the given error message. Avoid at all |
306 | Fatally aborts execution with the given error message. Avoid at all |
317 | 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 |
318 | starts up. |
308 | starts up. |
319 | |
309 | |
… | |
… | |
322 | newline. The module also overwrites the "warn" builtin with a |
312 | newline. The module also overwrites the "warn" builtin with a |
323 | function that calls this function. |
313 | function that calls this function. |
324 | |
314 | |
325 | Using this function has the advantage that its output ends up in the |
315 | Using this function has the advantage that its output ends up in the |
326 | correct place, e.g. on stderr of the connecting urxvtc client. |
316 | correct place, e.g. on stderr of the connecting urxvtc client. |
|
|
317 | |
|
|
318 | Messages have a size limit of 1023 bytes currently. |
327 | |
319 | |
328 | $is_safe = urxvt::safe |
320 | $is_safe = urxvt::safe |
329 | Returns true when it is safe to do potentially unsafe things, such |
321 | Returns true when it is safe to do potentially unsafe things, such |
330 | as evaluating perl code specified by the user. This is true when |
322 | as evaluating perl code specified by the user. This is true when |
331 | urxvt was started setuid or setgid. |
323 | urxvt was started setuid or setgid. |
… | |
… | |
385 | condition variables, but non-blocking condvar use is ok. What this means |
377 | condition variables, but non-blocking condvar use is ok. What this means |
386 | is that you cannot use blocking APIs, but the non-blocking variant |
378 | is that you cannot use blocking APIs, but the non-blocking variant |
387 | should work. |
379 | should work. |
388 | |
380 | |
389 | The "urxvt::term" Class |
381 | The "urxvt::term" Class |
|
|
382 | $term = new urxvt::term $envhashref, $rxvtname, [arg...] |
|
|
383 | Creates a new terminal, very similar as if you had started it with |
|
|
384 | system "$rxvtname, arg...". $envhashref must be a reference to a |
|
|
385 | %ENV-like hash which defines the environment of the new terminal. |
|
|
386 | |
|
|
387 | Croaks (and probably outputs an error message) if the new instance |
|
|
388 | couldn't be created. Returns "undef" if the new instance didn't |
|
|
389 | initialise perl, and the terminal object otherwise. The "init" and |
|
|
390 | "start" hooks will be called during this call. |
|
|
391 | |
390 | $term->destroy |
392 | $term->destroy |
391 | Destroy the terminal object (close the window, free resources etc.). |
393 | Destroy the terminal object (close the window, free resources etc.). |
392 | Please note that rxvt will not exit as long as any event watchers |
394 | Please note that rxvt will not exit as long as any event watchers |
393 | (timers, io watchers) are still active. |
395 | (timers, io watchers) are still active. |
394 | |
396 | |
… | |
… | |
577 | $max_scrollback = $term->saveLines |
579 | $max_scrollback = $term->saveLines |
578 | $nrow_plus_saveLines = $term->total_rows |
580 | $nrow_plus_saveLines = $term->total_rows |
579 | $lines_in_scrollback = $term->nsaved |
581 | $lines_in_scrollback = $term->nsaved |
580 | Return various integers describing terminal characteristics. |
582 | Return various integers describing terminal characteristics. |
581 | |
583 | |
|
|
584 | $x_display = $term->display_id |
|
|
585 | Return the DISPLAY used by rxvt-unicode. |
|
|
586 | |
582 | $lc_ctype = $term->locale |
587 | $lc_ctype = $term->locale |
583 | Returns the LC_CTYPE category string used by this rxvt-unicode. |
588 | Returns the LC_CTYPE category string used by this rxvt-unicode. |
584 | |
589 | |
585 | $x_display = $term->display_id |
590 | $env = $term->env |
586 | Return the DISPLAY used by rxvt-unicode. |
591 | Returns a copy of the environment in effect for the terminal as a |
|
|
592 | hashref similar to "\%ENV". |
587 | |
593 | |
588 | $modifiermask = $term->ModLevel3Mask |
594 | $modifiermask = $term->ModLevel3Mask |
589 | $modifiermask = $term->ModMetaMask |
595 | $modifiermask = $term->ModMetaMask |
590 | $modifiermask = $term->ModNumLockMask |
596 | $modifiermask = $term->ModNumLockMask |
591 | Return the modifier masks corresponding to the "ISO Level 3 Shift" |
597 | Return the modifier masks corresponding to the "ISO Level 3 Shift" |
… | |
… | |
727 | |
733 | |
728 | $popup->show |
734 | $popup->show |
729 | Displays the popup (which is initially hidden). |
735 | Displays the popup (which is initially hidden). |
730 | |
736 | |
731 | The "urxvt::timer" Class |
737 | The "urxvt::timer" Class |
732 | This class implements timer watchers/events. Time is represented as |
738 | This class implements timer watchers/events. Time is represented as a |
733 | a fractional number of seconds since the epoch. Example: |
739 | fractional number of seconds since the epoch. Example: |
734 | |
740 | |
735 | $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); |
736 | $term->{timer} = urxvt::timer |
742 | $term->{timer} = urxvt::timer |
737 | ->new |
743 | ->new |
738 | ->interval (1) |
744 | ->interval (1) |
739 | ->cb (sub { |
745 | ->cb (sub { |
740 | $term->{overlay}->set (0, 0, |
746 | $term->{overlay}->set (0, 0, |
741 | sprintf "%2d:%02d:%02d", (localtime urxvt::NOW)[2,1,0]); |
747 | sprintf "%2d:%02d:%02d", (localtime urxvt::NOW)[2,1,0]); |
742 | }); |
748 | }); |
743 | |
749 | |
744 | $timer = new urxvt::timer |
750 | $timer = new urxvt::timer |
745 | 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 |
746 | fire immediately. |
752 | immediately. |
747 | |
753 | |
748 | $timer = $timer->cb (sub { my ($timer) = @_; ... }) |
754 | $timer = $timer->cb (sub { my ($timer) = @_; ... }) |
749 | Set the callback to be called when the timer triggers. |
755 | Set the callback to be called when the timer triggers. |
750 | |
756 | |
751 | $tstamp = $timer->at |
757 | $tstamp = $timer->at |
752 | Return the time this watcher will fire next. |
758 | Return the time this watcher will fire next. |
753 | |
759 | |
754 | $timer = $timer->set ($tstamp) |
760 | $timer = $timer->set ($tstamp) |
755 | Set the time the event is generated to $tstamp. |
761 | Set the time the event is generated to $tstamp. |
756 | |
762 | |
757 | $timer = $timer->interval ($interval) |
763 | $timer = $timer->interval ($interval) |
758 | Normally (and when $interval is 0), the timer will automatically |
764 | Normally (and when $interval is 0), the timer will automatically |
759 | 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 |
760 | timer is automatically rescheduled at the given intervals. |
766 | timer is automatically rescheduled at the given intervals. |
761 | |
767 | |
762 | $timer = $timer->start |
768 | $timer = $timer->start |
763 | Start the timer. |
769 | Start the timer. |
764 | |
770 | |
765 | $timer = $timer->start ($tstamp) |
771 | $timer = $timer->start ($tstamp) |
766 | Set the event trigger time to $tstamp and start the timer. |
772 | Set the event trigger time to $tstamp and start the timer. |
767 | |
773 | |
768 | $timer = $timer->stop |
774 | $timer = $timer->stop |
769 | Stop the timer. |
775 | Stop the timer. |
770 | |
776 | |
771 | The "urxvt::iow" Class |
777 | The "urxvt::iow" Class |
772 | This class implements io watchers/events. Example: |
778 | This class implements io watchers/events. Example: |
773 | |
779 | |
774 | $term->{socket} = ... |
780 | $term->{socket} = ... |
775 | $term->{iow} = urxvt::iow |
781 | $term->{iow} = urxvt::iow |
776 | ->new |
782 | ->new |
777 | ->fd (fileno $term->{socket}) |
783 | ->fd (fileno $term->{socket}) |
778 | ->events (urxvt::EVENT_READ) |
784 | ->events (urxvt::EVENT_READ) |
779 | ->start |
785 | ->start |
780 | ->cb (sub { |
786 | ->cb (sub { |
781 | my ($iow, $revents) = @_; |
787 | my ($iow, $revents) = @_; |
782 | # $revents must be 1 here, no need to check |
788 | # $revents must be 1 here, no need to check |
783 | sysread $term->{socket}, my $buf, 8192 |
789 | sysread $term->{socket}, my $buf, 8192 |
784 | or end-of-file; |
790 | or end-of-file; |
785 | }); |
791 | }); |
786 | |
792 | |
787 | $iow = new urxvt::iow |
793 | $iow = new urxvt::iow |
788 | Create a new io watcher object in stopped state. |
794 | Create a new io watcher object in stopped state. |
789 | |
795 | |
790 | $iow = $iow->cb (sub { my ($iow, $reventmask) = @_; ... }) |
796 | $iow = $iow->cb (sub { my ($iow, $reventmask) = @_; ... }) |
791 | Set the callback to be called when io events are triggered. |
797 | Set the callback to be called when io events are triggered. |
792 | $reventmask is a bitset as described in the "events" method. |
798 | $reventmask is a bitset as described in the "events" method. |
793 | |
799 | |
794 | $iow = $iow->fd ($fd) |
800 | $iow = $iow->fd ($fd) |
795 | Set the filedescriptor (not handle) to watch. |
801 | Set the filedescriptor (not handle) to watch. |
796 | |
802 | |
797 | $iow = $iow->events ($eventmask) |
803 | $iow = $iow->events ($eventmask) |
798 | Set the event mask to watch. The only allowed values are |
804 | Set the event mask to watch. The only allowed values are |
799 | "urxvt::EVENT_READ" and "urxvt::EVENT_WRITE", which might be |
805 | "urxvt::EVENT_READ" and "urxvt::EVENT_WRITE", which might be ORed |
800 | ORed together, or "urxvt::EVENT_NONE". |
806 | together, or "urxvt::EVENT_NONE". |
801 | |
807 | |
802 | $iow = $iow->start |
808 | $iow = $iow->start |
803 | Start watching for requested events on the given handle. |
809 | Start watching for requested events on the given handle. |
804 | |
810 | |
805 | $iow = $iow->stop |
811 | $iow = $iow->stop |
806 | Stop watching for events on the given filehandle. |
812 | Stop watching for events on the given filehandle. |
807 | |
813 | |
808 | ENVIRONMENT |
814 | ENVIRONMENT |
809 | URXVT_PERL_VERBOSITY |
815 | URXVT_PERL_VERBOSITY |
810 | This variable controls the verbosity level of the perl extension. |
816 | This variable controls the verbosity level of the perl extension. Higher |
811 | Higher numbers indicate more verbose output. |
817 | numbers indicate more verbose output. |
812 | |
818 | |
813 | == 0 - fatal messages |
819 | == 0 - fatal messages |
814 | >= 3 - script loading and management |
820 | >= 3 - script loading and management |
815 | >=10 - all events received |
821 | >=10 - all events received |
816 | |
822 | |
817 | AUTHOR |
823 | AUTHOR |
818 | Marc Lehmann <pcg@goof.com> |
824 | Marc Lehmann <pcg@goof.com> |
819 | http://software.schmorp.de/pkg/rxvt-unicode |
825 | http://software.schmorp.de/pkg/rxvt-unicode |
820 | |
826 | |