at start of rxvt execution. This option requires --enable-utmp to
also be specified.
- --enable-xpm-background (default: off)
+ --enable-xpm-background (default: on)
Add support for XPM background pixmaps.
- --enable-transparency (default: off)
+ --enable-transparency (default: on)
Add support for inheriting parent backgrounds thus giving a fake
transparency to the term.
Add support for tinting of transparent backgrounds (requires
"--enable-transparency").
- --enable-menubar (default: off)
+ --enable-menubar (default: off) [DEPRECATED]
Add support for our menu bar system (this interacts badly with
- dynamic locale switching currently).
+ dynamic locale switching currently). This option is DEPRECATED and
+ will be removed in the future.
--enable-rxvt-scroll (default: on)
Add support for the original rxvt scrollbar.
});</pre>
</dd>
<p></p>
-<dt><strong><a name="item__2dpty_2dfd_fileno"><strong>-pty-fd</strong> <em>fileno</em></a></strong><br />
+<dt><strong><a name="item__2dpty_2dfd_file_descriptor"><strong>-pty-fd</strong> <em>file descriptor</em></a></strong><br />
</dt>
<dd>
Tells rxvt NOT to execute any commands or create a new pty/tty
yourself if you want that.</p>
</dd>
<dd>
+<p>As an extremely special case, specifying <code>-1</code> will completely suppress
+pty/tty operations.</p>
+</dd>
+<dd>
<p>Here is a example in perl that illustrates how this option can be used (a
longer example is in <em>doc/pty-fd</em>):</p>
</dd>
<dt><strong><a name="item__2dpe_string"><strong>-pe</strong> <em>string</em></a></strong><br />
</dt>
<dd>
-Colon-separated list of perl extension scripts to use in this terminal
+Comma-separated list of perl extension scripts to use in this terminal
instance. See resource <strong>perl-ext</strong>.
</dd>
<p></p></dl>
<dt><strong><a name="item_perl_2dext_3a_string"><strong>perl-ext</strong>: <em>string</em></a></strong><br />
</dt>
<dd>
-Colon-separated <code>list(s)</code> of perl extension scripts to use in this terminal
+Comma-separated <code>list(s)</code> of perl extension scripts to use in this terminal
instance. Each extension is looked up in the library directories, loaded
if necessary, and bound to the current terminal instance. If this
resource is empty or missing, then the perl interpreter will not be
.\" ========================================================================
.\"
.IX Title "rxvt 1"
-.TH rxvt 1 "2006-01-04" "6.3" "RXVT-UNICODE"
+.TH rxvt 1 "2006-01-07" "6.3" "RXVT-UNICODE"
.SH "NAME"
rxvt\-unicode (ouR XVT, unicode) \- (a VT102 emulator for the X window system)
.SH "SYNOPSIS"
\& system "@@RXVT_NAME@@ -embed $xid &";
\& });
.Ve
-.IP "\fB\-pty\-fd\fR \fIfileno\fR" 4
-.IX Item "-pty-fd fileno"
+.IP "\fB\-pty\-fd\fR \fIfile descriptor\fR" 4
+.IX Item "-pty-fd file descriptor"
Tells @@RXVT_NAME@@ \s-1NOT\s0 to execute any commands or create a new pty/tty
pair but instead use the given filehandle as the tty master. This is
useful if you want to drive @@RXVT_NAME@@ as a generic terminal emulator
entries and will not tinker with pty/tty permissions \- you have to do that
yourself if you want that.
.Sp
+As an extremely special case, specifying \f(CW\*(C`\-1\*(C'\fR will completely suppress
+pty/tty operations.
+.Sp
Here is a example in perl that illustrates how this option can be used (a
longer example is in \fIdoc/pty\-fd\fR):
.Sp
.Ve
.IP "\fB\-pe\fR \fIstring\fR" 4
.IX Item "-pe string"
-Colon-separated list of perl extension scripts to use in this terminal
+Comma-separated list of perl extension scripts to use in this terminal
instance. See resource \fBperl-ext\fR.
.SH "RESOURCES (available also as long\-options)"
.IX Header "RESOURCES (available also as long-options)"
.IP "\fBperl-ext\fR: \fIstring\fR" 4
.IX Item "perl-ext: string"
.PD
-Colon-separated list(s) of perl extension scripts to use in this terminal
+Comma-separated list(s) of perl extension scripts to use in this terminal
instance. Each extension is looked up in the library directories, loaded
if necessary, and bound to the current terminal instance. If this
resource is empty or missing, then the perl interpreter will not be
system "rxvt -embed $xid &";
});
- -pty-fd *fileno*
+ -pty-fd *file descriptor*
Tells rxvt NOT to execute any commands or create a new pty/tty pair
but instead use the given filehandle as the tty master. This is
useful if you want to drive rxvt as a generic terminal emulator
and will not tinker with pty/tty permissions - you have to do that
yourself if you want that.
+ As an extremely special case, specifying -1 will completely suppress
+ pty/tty operations.
+
Here is a example in perl that illustrates how this option can be
used (a longer example is in doc/pty-fd):
while (<$slave>) { print $slave "got <$_>\n" }
-pe *string*
- Colon-separated list of perl extension scripts to use in this
+ Comma-separated list of perl extension scripts to use in this
terminal instance. See resource perl-ext.
RESOURCES (available also as long-options)
perl-ext-common: *string*
perl-ext: *string*
- Colon-separated list(s) of perl extension scripts to use in this
+ Comma-separated list(s) of perl extension scripts to use in this
terminal instance. Each extension is looked up in the library
directories, loaded if necessary, and bound to the current terminal
instance. If this resource is empty or missing, then the perl
--enable-utmp to also be specified.
</dd>
<p></p>
-<dt><strong><a name="item_background">--enable-xpm-background (default: off)</a></strong><br />
+<dt><strong><a name="item_background">--enable-xpm-background (default: on)</a></strong><br />
</dt>
<dd>
Add support for XPM background pixmaps.
</dd>
<p></p>
-<dt><strong><a name="item_transparency">--enable-transparency (default: off)</a></strong><br />
+<dt><strong><a name="item_transparency">--enable-transparency (default: on)</a></strong><br />
</dt>
<dd>
Add support for inheriting parent backgrounds thus giving a fake
Add support for tinting of transparent backgrounds (requires <code>--enable-transparency</code>).
</dd>
<p></p>
-<dt><strong><a name="item_menubar">--enable-menubar (default: off)</a></strong><br />
+<dt><strong><a name="item_menubar">--enable-menubar (default: off) [DEPRECATED]</a></strong><br />
</dt>
<dd>
-Add support for our menu bar system (this interacts badly with
-dynamic locale switching currently).
+Add support for our menu bar system (this interacts badly with dynamic
+locale switching currently). This option is DEPRECATED and will be removed
+in the future.
</dd>
<p></p>
<dt><strong><a name="item_scroll">--enable-rxvt-scroll (default: on)</a></strong><br />
.\" ========================================================================
.\"
.IX Title "rxvt 7"
-.TH rxvt 7 "2006-01-04" "6.3" "RXVT-UNICODE"
+.TH rxvt 7 "2006-01-07" "6.3" "RXVT-UNICODE"
.SH "NAME"
RXVT REFERENCE \- FAQ, command sequences and other background information
.SH "SYNOPSIS"
Write user and tty to lastlog file (used by programs like
\&\fIlastlogin\fR) at start of rxvt execution. This option requires
\&\-\-enable\-utmp to also be specified.
-.IP "\-\-enable\-xpm\-background (default: off)" 4
-.IX Item "--enable-xpm-background (default: off)"
+.IP "\-\-enable\-xpm\-background (default: on)" 4
+.IX Item "--enable-xpm-background (default: on)"
Add support for \s-1XPM\s0 background pixmaps.
-.IP "\-\-enable\-transparency (default: off)" 4
-.IX Item "--enable-transparency (default: off)"
+.IP "\-\-enable\-transparency (default: on)" 4
+.IX Item "--enable-transparency (default: on)"
Add support for inheriting parent backgrounds thus giving a fake
transparency to the term.
.IP "\-\-enable\-fading (default: on)" 4
.IP "\-\-enable\-tinting (default: on)" 4
.IX Item "--enable-tinting (default: on)"
Add support for tinting of transparent backgrounds (requires \f(CW\*(C`\-\-enable\-transparency\*(C'\fR).
-.IP "\-\-enable\-menubar (default: off)" 4
-.IX Item "--enable-menubar (default: off)"
-Add support for our menu bar system (this interacts badly with
-dynamic locale switching currently).
+.IP "\-\-enable\-menubar (default: off) [\s-1DEPRECATED\s0]" 4
+.IX Item "--enable-menubar (default: off) [DEPRECATED]"
+Add support for our menu bar system (this interacts badly with dynamic
+locale switching currently). This option is \s-1DEPRECATED\s0 and will be removed
+in the future.
.IP "\-\-enable\-rxvt\-scroll (default: on)" 4
.IX Item "--enable-rxvt-scroll (default: on)"
Add support for the original rxvt scrollbar.
F<lastlogin>) at start of rxvt execution. This option requires
--enable-utmp to also be specified.
-=item --enable-xpm-background (default: off)
+=item --enable-xpm-background (default: on)
Add support for XPM background pixmaps.
-=item --enable-transparency (default: off)
+=item --enable-transparency (default: on)
Add support for inheriting parent backgrounds thus giving a fake
transparency to the term.
Add support for tinting of transparent backgrounds (requires C<--enable-transparency>).
-=item --enable-menubar (default: off)
+=item --enable-menubar (default: off) [DEPRECATED]
-Add support for our menu bar system (this interacts badly with
-dynamic locale switching currently).
+Add support for our menu bar system (this interacts badly with dynamic
+locale switching currently). This option is DEPRECATED and will be removed
+in the future.
=item --enable-rxvt-scroll (default: on)
at start of rxvt execution. This option requires --enable-utmp to
also be specified.
- --enable-xpm-background (default: off)
+ --enable-xpm-background (default: on)
Add support for XPM background pixmaps.
- --enable-transparency (default: off)
+ --enable-transparency (default: on)
Add support for inheriting parent backgrounds thus giving a fake
transparency to the term.
Add support for tinting of transparent backgrounds (requires
"--enable-transparency").
- --enable-menubar (default: off)
+ --enable-menubar (default: off) [DEPRECATED]
Add support for our menu bar system (this interacts badly with
- dynamic locale switching currently).
+ dynamic locale switching currently). This option is DEPRECATED and
+ will be removed in the future.
--enable-rxvt-scroll (default: on)
Add support for the original rxvt scrollbar.
Displays a digital clock using the built-in overlay.
</dd>
<p></p>
+<dt><strong><a name="item_mark_2durls">mark-urls</a></strong><br />
+</dt>
+<dd>
+Uses per-line display filtering (<code>on_line_update</code>) to underline urls.
+</dd>
+<p></p>
+<dt><strong><a name="item_block_2dgraphics_2dto_2dascii">block-graphics-to-ascii</a></strong><br />
+</dt>
+<dd>
+A not very useful example of filtering all text output to the terminal,
+by replacing all line-drawing characters (U+2500 .. U+259F) by a
+similar-looking ascii character.
+</dd>
+<p></p>
<dt><strong><a name="item_example_2drefresh_2dhooks">example-refresh-hooks</a></strong><br />
</dt>
<dd>
emptied, so its best to store related objects such as time watchers and
the like inside the terminal object so they get destroyed as soon as the
terminal is destroyed.</p>
+<p>Argument names also often indicate the type of a parameter. Here are some
+hints on what they mean:</p>
+<dl>
+<dt><strong><a name="item__24text">$text</a></strong><br />
+</dt>
+<dd>
+Rxvt-unicodes special way of encoding text, where one ``unicode'' character
+always represents one screen cell. See <em>row_t</em> for a discussion of this format.
+</dd>
+<p></p>
+<dt><strong><a name="item__24string">$string</a></strong><br />
+</dt>
+<dd>
+A perl text string, with an emphasis on <em>text</em>. It can store all unicode
+characters and is to be distinguished with text encoded in a specific
+encoding (often locale-specific) and binary data.
+</dd>
+<p></p>
+<dt><strong><a name="item__24octets">$octets</a></strong><br />
+</dt>
+<dd>
+Either binary data or - more common - a text string encoded in a
+locale-specific way.
+</dd>
+<p></p></dl>
<p>
</p>
<h2><a name="hooks">Hooks</a></h2>
-<p>The following subroutines can be declared in loaded scripts, and will be
+<p>The following subroutines can be declared in extension files, and will be
called whenever the relevant event happens.</p>
<p>The first argument passed to them is an object private to each terminal
and extension package. You can call all <code>urxvt::term</code> methods on it, but
</dt>
<dd>
Called after a new terminal object has been initialized, but before
-windows are created or the command gets run.
+windows are created or the command gets run. Most methods are unsafe to
+call or deliver senseless data, as terminal size and other characteristics
+have not yet been determined. You can safely query and change resources,
+though.
</dd>
<p></p>
<dt><strong><a name="item_on_reset__24term">on_reset $term</a></strong><br />
other users on the same system etc.).</p>
</dd>
<p></p>
+<dt><strong><a name="item_on_add_lines__24term_2c__24string">on_add_lines $term, $string</a></strong><br />
+</dt>
+<dd>
+Called whenever text is about to be output, with the text as argument. You
+can filter/change and output the text yourself by returning a true value
+and calling <a href="#item_scr_add_lines"><code>$term->scr_add_lines</code></a> yourself. Please note that this
+might be very slow, however, as your hook is called for <strong>all</strong> text being
+output.
+</dd>
+<p></p>
+<dt><strong><a name="item_on_line_update__24term_2c__24row">on_line_update $term, $row</a></strong><br />
+</dt>
+<dd>
+Called whenever a line was updated or changed. Can be used to filter
+screen output (e.g. underline urls or other useless stuff). Only lines
+that are being shown will be filtered, and, due to performance reasons,
+not always immediately.
+</dd>
+<dd>
+<p>The row number is always the topmost row of the line if the line spans
+multiple rows.</p>
+</dd>
+<dd>
+<p>Please note that, if you change the line, then the hook might get called
+later with the already-modified line (e.g. if unrelated parts change), so
+you cannot just toggle rendition bits, but only set them.</p>
+</dd>
+<p></p>
<dt><strong><a name="item_on_refresh_begin__24term">on_refresh_begin $term</a></strong><br />
</dt>
<dd>
<code>perl:string</code> action bound to it (see description of the <strong>keysym</strong>
resource in the <code>rxvt(1)</code> manpage).
</dd>
+<p></p>
+<dt><strong><a name="item_on_key_press__24term_2c__24event_2c__24octets">on_key_press $term, $event, $octets</a></strong><br />
+</dt>
+<dt><strong><a name="item_on_key_release__24term_2c__24event">on_key_release $term, $event</a></strong><br />
+</dt>
+<dt><strong><a name="item_on_button_press__24term_2c__24event">on_button_press $term, $event</a></strong><br />
+</dt>
+<dt><strong><a name="item_on_button_release__24term_2c__24event">on_button_release $term, $event</a></strong><br />
+</dt>
+<dt><strong><a name="item_on_motion_notify__24term_2c__24event">on_motion_notify $term, $event</a></strong><br />
+</dt>
+<dd>
+Called whenever the corresponding X event is received for the terminal If
+the hook returns true, then the even will be ignored by rxvt-unicode.
+</dd>
+<dd>
+<p>The event is a hash with most values as named by Xlib (see the XEvent
+manpage), with the additional members <code>row</code> and <code>col</code>, which are the row
+and column under the mouse cursor.</p>
+</dd>
+<dd>
+<p><code>on_key_press</code> additionally receives the string rxvt-unicode would
+output, if any, in locale-specific encoding.</p>
+</dd>
+<dd>
+<p>subwindow.</p>
+</dd>
<p></p></dl>
<p>
</p>
<dt><strong><a name="item__24urxvt_3a_3aterm">$urxvt::TERM</a></strong><br />
</dt>
<dd>
-The current terminal. Whenever a callback/Hook is bein executed, this
-variable stores the current <code>urxvt::term</code> object.
+The current terminal. This variable stores the current <code>urxvt::term</code>
+object, whenever a callback/hook is executing.
</dd>
<p></p></dl>
<p>
</p>
<h2><a name="functions_in_the_urxvt_package">Functions in the <code>urxvt</code> Package</a></h2>
<dl>
+<dt><strong><a name="item__24term__3d_new_urxvt__5barg_2e_2e_2e_5d">$term = new urxvt [arg...]</a></strong><br />
+</dt>
+<dd>
+Creates a new terminal, very similar as if you had started it with
+<code>system $binfile, arg...</code>. Croaks (and probably outputs an error message)
+if the new instance couldn't be created. Returns <code>undef</code> if the new
+instance didn't initialise perl, and the terminal object otherwise. The
+<code>init</code> and <a href="#item_start"><code>start</code></a> hooks will be called during the call.
+</dd>
+<p></p>
<dt><strong><a name="item_urxvt_3a_3afatal__24errormessage">urxvt::fatal $errormessage</a></strong><br />
</dt>
<dd>
</p>
<h2><a name="the_urxvt__term_class">The <code>urxvt::term</code> Class</a></h2>
<dl>
+<dt><strong><a name="item_destroy">$term->destroy</a></strong><br />
+</dt>
+<dd>
+Destroy the terminal object (close the window, free resources etc.).
+</dd>
+<p></p>
<dt><strong><a name="item_resource">$value = $term->resource ($name[, $newval])</a></strong><br />
</dt>
<dd>
utmpInhibit visualBell</pre>
</dd>
<p></p>
-<dt><strong><a name="item_screen_rstyle">$rend = $term->screen_rstyle ([$new_rstyle])</a></strong><br />
+<dt><strong><a name="item_rstyle">$rend = $term->rstyle ([$new_rstyle])</a></strong><br />
</dt>
<dd>
-Return and optionally change the current rendition. Text thta is output by
-the temrianl application will use this style.
+Return and optionally change the current rendition. Text that is output by
+the terminal application will use this style.
</dd>
<p></p>
<dt><strong><a name="item_screen_cur">($row, $col) = $term->screen_cur ([$row, $col])</a></strong><br />
#
#Create a simple multi-line overlay box. See the next method for details.
#
-#=cut</p>
-</dd>
-<dd>
-<p>sub urxvt::term::scr_overlay {
-die;
- my ($self, $x, $y, $text) = @_;</p>
-</dd>
-<dd>
-<pre>
- my @lines = split /\n/, $text;</pre>
-</dd>
-<dd>
-<pre>
- my $w = 0;
- for (map $self->strwidth ($_), @lines) {
- $w = $_ if $w < $_;
- }</pre>
-</dd>
-<dd>
-<pre>
- $self->scr_overlay_new ($x, $y, $w, scalar @lines);
- $self->scr_overlay_set (0, $_, $lines[$_]) for 0.. $#lines;
-}</pre>
+#=cut
+#
+#sub urxvt::term::scr_overlay {
+# my ($self, $x, $y, $text) = @_;
+#
+# my @lines = split /\n/, $text;
+#
+# my $w = 0;
+# for (map $self->strwidth ($_), @lines) {
+# $w = $_ if $w < $_;
+# }
+#
+# $self->scr_overlay_new ($x, $y, $w, scalar @lines);
+# $self->scr_overlay_set (0, $_, $lines[$_]) for 0.. $#lines;
+#}</p>
</dd>
<p></p>
<dt><strong><a name="item_overlay">$term->overlay ($x, $y, $width, $height[, $rstyle[, $border]])</a></strong><br />
If hidden, display the overlay again.
</dd>
<p></p></dl>
-<dt><strong><a name="item_strwidth">$cellwidth = $term->strwidth $string</a></strong><br />
+<dt><strong><a name="item_strwidth">$cellwidth = $term->strwidth ($string)</a></strong><br />
</dt>
<dd>
Returns the number of screen-cells this string would need. Correctly
accounts for wide and combining characters.
</dd>
<p></p>
-<dt><strong><a name="item_locale_encode">$octets = $term->locale_encode $string</a></strong><br />
+<dt><strong><a name="item_locale_encode">$octets = $term->locale_encode ($string)</a></strong><br />
</dt>
<dd>
Convert the given text string into the corresponding locale encoding.
</dd>
<p></p>
-<dt><strong><a name="item_locale_decode">$string = $term->locale_decode $octets</a></strong><br />
+<dt><strong><a name="item_locale_decode">$string = $term->locale_decode ($octets)</a></strong><br />
</dt>
<dd>
Convert the given locale-encoded octets into a perl string.
</dd>
<p></p>
+<dt><strong><a name="item_scr_add_lines">$term->scr_add_lines ($string)</a></strong><br />
+</dt>
+<dd>
+Write the given text string to the screen, as if output by the application
+running inside the terminal. It may not contain command sequences (escape
+codes), but is free to use line feeds, carriage returns and tabs. The
+string is a normal text string, not in locale-dependent encoding.
+</dd>
+<dd>
+<p>Normally its not a good idea to use this function, as programs might be
+confused by changes in cursor position or scrolling. Its useful inside a
+<code>on_add_lines</code> hook, though.</p>
+</dd>
+<p></p>
+<dt><strong><a name="item_cmd_parse">$term->cmd_parse ($octets)</a></strong><br />
+</dt>
+<dd>
+Similar to <a href="#item_scr_add_lines"><code>scr_add_lines</code></a>, but the argument must be in the
+locale-specific encoding of the terminal and can contain command sequences
+(escape codes) that will be interpreted.
+</dd>
+<p></p>
<dt><strong><a name="item_tt_write">$term->tt_write ($octets)</a></strong><br />
</dt>
<dd>
to the locale-specific encoding using <a href="#item_locale_encode"><code>$term->locale_encode</code></a>.
</dd>
<p></p>
+<dt><strong><a name="item_parent">$windowid = $term->parent</a></strong><br />
+</dt>
+<dd>
+Return the window id of the toplevel window.
+</dd>
+<p></p>
+<dt><strong><a name="item_vt">$windowid = $term->vt</a></strong><br />
+</dt>
+<dd>
+Return the window id of the terminal window.
+</dd>
+<p></p>
<dt><strong><a name="item_width">$window_width = $term->width</a></strong><br />
</dt>
<dt><strong><a name="item_height">$window_height = $term->height</a></strong><br />
automatically be updated.</p>
</dd>
<dd>
-<p><code>$text</code> is in a special encoding: tabs and wide characters that use more
+<p><a href="#item__24text"><code>$text</code></a> is in a special encoding: tabs and wide characters that use more
than one cell when displayed are padded with urxvt::NOCHAR characters
(<code>chr 65535</code>). Characters with combining characters and other characters
that do not fit into the normal tetx encoding will be replaced with
following methods:
</dd>
<dl>
-<dt><strong><a name="item_t">$text = $line->t</a></strong><br />
+<dt><strong><a name="item_t">$text = $line->t ([$new_text])</a></strong><br />
</dt>
<dd>
-Returns the full text of the line, similar to <a href="#item_row_t"><code>ROW_t</code></a>
+Returns or replaces the full text of the line, similar to <a href="#item_row_t"><code>ROW_t</code></a>
</dd>
<p></p>
-<dt><strong><a name="item_r">$rend = $line->r</a></strong><br />
+<dt><strong><a name="item_r">$rend = $line->r ([$new_rend])</a></strong><br />
</dt>
<dd>
-Returns the full rendition array of the line, similar to <a href="#item_row_r"><code>ROW_r</code></a>
+Returns or replaces the full rendition array of the line, similar to <a href="#item_row_r"><code>ROW_r</code></a>
</dd>
<p></p>
<dt><strong><a name="item_l">$length = $line->l</a></strong><br />
.\" ========================================================================
.\"
.IX Title "rxvt 3"
-.TH rxvt 3 "2006-01-04" "6.3" "RXVT-UNICODE"
+.TH rxvt 3 "2006-01-07" "6.3" "RXVT-UNICODE"
.SH "NAME"
@@RXVT_NAME@@perl \- rxvt\-unicode's embedded perl interpreter
.SH "SYNOPSIS"
.IP "digital-clock" 4
.IX Item "digital-clock"
Displays a digital clock using the built-in overlay.
+.IP "mark-urls" 4
+.IX Item "mark-urls"
+Uses per-line display filtering (\f(CW\*(C`on_line_update\*(C'\fR) to underline urls.
+.IP "block-graphics-to-ascii" 4
+.IX Item "block-graphics-to-ascii"
+A not very useful example of filtering all text output to the terminal,
+by replacing all line-drawing characters (U+2500 .. U+259F) by a
+similar-looking ascii character.
.IP "example-refresh-hooks" 4
.IX Item "example-refresh-hooks"
Displays a very simple digital clock in the upper right corner of the
emptied, so its best to store related objects such as time watchers and
the like inside the terminal object so they get destroyed as soon as the
terminal is destroyed.
+.PP
+Argument names also often indicate the type of a parameter. Here are some
+hints on what they mean:
+.IP "$text" 4
+.IX Item "$text"
+Rxvt-unicodes special way of encoding text, where one \*(L"unicode\*(R" character
+always represents one screen cell. See row_t for a discussion of this format.
+.IP "$string" 4
+.IX Item "$string"
+A perl text string, with an emphasis on \fItext\fR. It can store all unicode
+characters and is to be distinguished with text encoded in a specific
+encoding (often locale\-specific) and binary data.
+.IP "$octets" 4
+.IX Item "$octets"
+Either binary data or \- more common \- a text string encoded in a
+locale-specific way.
.Sh "Hooks"
.IX Subsection "Hooks"
-The following subroutines can be declared in loaded scripts, and will be
+The following subroutines can be declared in extension files, and will be
called whenever the relevant event happens.
.PP
The first argument passed to them is an object private to each terminal
.el .IP "on_init \f(CW$term\fR" 4
.IX Item "on_init $term"
Called after a new terminal object has been initialized, but before
-windows are created or the command gets run.
+windows are created or the command gets run. Most methods are unsafe to
+call or deliver senseless data, as terminal size and other characteristics
+have not yet been determined. You can safely query and change resources,
+though.
.ie n .IP "on_reset $term" 4
.el .IP "on_reset \f(CW$term\fR" 4
.IX Item "on_reset $term"
Be careful not ever to trust (in a security sense) the data you receive,
as its source can not easily be controleld (e\-mail content, messages from
other users on the same system etc.).
+.ie n .IP "on_add_lines $term\fR, \f(CW$string" 4
+.el .IP "on_add_lines \f(CW$term\fR, \f(CW$string\fR" 4
+.IX Item "on_add_lines $term, $string"
+Called whenever text is about to be output, with the text as argument. You
+can filter/change and output the text yourself by returning a true value
+and calling \f(CW\*(C`$term\->scr_add_lines\*(C'\fR yourself. Please note that this
+might be very slow, however, as your hook is called for \fBall\fR text being
+output.
+.ie n .IP "on_line_update $term\fR, \f(CW$row" 4
+.el .IP "on_line_update \f(CW$term\fR, \f(CW$row\fR" 4
+.IX Item "on_line_update $term, $row"
+Called whenever a line was updated or changed. Can be used to filter
+screen output (e.g. underline urls or other useless stuff). Only lines
+that are being shown will be filtered, and, due to performance reasons,
+not always immediately.
+.Sp
+The row number is always the topmost row of the line if the line spans
+multiple rows.
+.Sp
+Please note that, if you change the line, then the hook might get called
+later with the already-modified line (e.g. if unrelated parts change), so
+you cannot just toggle rendition bits, but only set them.
.ie n .IP "on_refresh_begin $term" 4
.el .IP "on_refresh_begin \f(CW$term\fR" 4
.IX Item "on_refresh_begin $term"
Called whenever the user presses a key combination that has a
\&\f(CW\*(C`perl:string\*(C'\fR action bound to it (see description of the \fBkeysym\fR
resource in the @@RXVT_NAME@@(1) manpage).
+.ie n .IP "on_key_press $term\fR, \f(CW$event\fR, \f(CW$octets" 4
+.el .IP "on_key_press \f(CW$term\fR, \f(CW$event\fR, \f(CW$octets\fR" 4
+.IX Item "on_key_press $term, $event, $octets"
+.PD 0
+.ie n .IP "on_key_release $term\fR, \f(CW$event" 4
+.el .IP "on_key_release \f(CW$term\fR, \f(CW$event\fR" 4
+.IX Item "on_key_release $term, $event"
+.ie n .IP "on_button_press $term\fR, \f(CW$event" 4
+.el .IP "on_button_press \f(CW$term\fR, \f(CW$event\fR" 4
+.IX Item "on_button_press $term, $event"
+.ie n .IP "on_button_release $term\fR, \f(CW$event" 4
+.el .IP "on_button_release \f(CW$term\fR, \f(CW$event\fR" 4
+.IX Item "on_button_release $term, $event"
+.ie n .IP "on_motion_notify $term\fR, \f(CW$event" 4
+.el .IP "on_motion_notify \f(CW$term\fR, \f(CW$event\fR" 4
+.IX Item "on_motion_notify $term, $event"
+.PD
+Called whenever the corresponding X event is received for the terminal If
+the hook returns true, then the even will be ignored by rxvt\-unicode.
+.Sp
+The event is a hash with most values as named by Xlib (see the XEvent
+manpage), with the additional members \f(CW\*(C`row\*(C'\fR and \f(CW\*(C`col\*(C'\fR, which are the row
+and column under the mouse cursor.
+.Sp
+\&\f(CW\*(C`on_key_press\*(C'\fR additionally receives the string rxvt-unicode would
+output, if any, in locale-specific encoding.
+.Sp
+subwindow.
.ie n .Sh "Variables in the ""urxvt"" Package"
.el .Sh "Variables in the \f(CWurxvt\fP Package"
.IX Subsection "Variables in the urxvt Package"
.IP "$urxvt::TERM" 4
.IX Item "$urxvt::TERM"
-The current terminal. Whenever a callback/Hook is bein executed, this
-variable stores the current \f(CW\*(C`urxvt::term\*(C'\fR object.
+The current terminal. This variable stores the current \f(CW\*(C`urxvt::term\*(C'\fR
+object, whenever a callback/hook is executing.
.ie n .Sh "Functions in the ""urxvt"" Package"
.el .Sh "Functions in the \f(CWurxvt\fP Package"
.IX Subsection "Functions in the urxvt Package"
+.IP "$term = new urxvt [arg...]" 4
+.IX Item "$term = new urxvt [arg...]"
+Creates a new terminal, very similar as if you had started it with
+\&\f(CW\*(C`system $binfile, arg...\*(C'\fR. Croaks (and probably outputs an error message)
+if the new instance couldn't be created. Returns \f(CW\*(C`undef\*(C'\fR if the new
+instance didn't initialise perl, and the terminal object otherwise. The
+\&\f(CW\*(C`init\*(C'\fR and \f(CW\*(C`start\*(C'\fR hooks will be called during the call.
.ie n .IP "urxvt::fatal $errormessage" 4
.el .IP "urxvt::fatal \f(CW$errormessage\fR" 4
.IX Item "urxvt::fatal $errormessage"
.ie n .Sh "The ""urxvt::term"" Class"
.el .Sh "The \f(CWurxvt::term\fP Class"
.IX Subsection "The urxvt::term Class"
+.IP "$term\->destroy" 4
+.IX Item "$term->destroy"
+Destroy the terminal object (close the window, free resources etc.).
.ie n .IP "$value = $term\fR\->resource ($name[, \f(CW$newval])" 4
.el .IP "$value = \f(CW$term\fR\->resource ($name[, \f(CW$newval\fR])" 4
.IX Item "$value = $term->resource ($name[, $newval])"
\& shade term_name title transparent transparent_all tripleclickwords
\& utmpInhibit visualBell
.Ve
-.ie n .IP "$rend = $term\->screen_rstyle ([$new_rstyle])" 4
-.el .IP "$rend = \f(CW$term\fR\->screen_rstyle ([$new_rstyle])" 4
-.IX Item "$rend = $term->screen_rstyle ([$new_rstyle])"
-Return and optionally change the current rendition. Text thta is output by
-the temrianl application will use this style.
+.ie n .IP "$rend = $term\->rstyle ([$new_rstyle])" 4
+.el .IP "$rend = \f(CW$term\fR\->rstyle ([$new_rstyle])" 4
+.IX Item "$rend = $term->rstyle ([$new_rstyle])"
+Return and optionally change the current rendition. Text that is output by
+the terminal application will use this style.
.ie n .IP "($row, $col\fR) = \f(CW$term\fR\->screen_cur ([$row, \f(CW$col])" 4
.el .IP "($row, \f(CW$col\fR) = \f(CW$term\fR\->screen_cur ([$row, \f(CW$col\fR])" 4
.IX Item "($row, $col) = $term->screen_cur ([$row, $col])"
#Create a simple multi-line overlay box. See the next method for details.
#
#=cut
-.Sp
-sub urxvt::term::scr_overlay {
-die;
- my ($self, \f(CW$x\fR, \f(CW$y\fR, \f(CW$text\fR) = \f(CW@_\fR;
-.Sp
-.Vb 1
-\& my @lines = split /\en/, $text;
-.Ve
-.Sp
-.Vb 4
-\& my $w = 0;
-\& for (map $self->strwidth ($_), @lines) {
-\& $w = $_ if $w < $_;
-\& }
-.Ve
-.Sp
-.Vb 3
-\& $self->scr_overlay_new ($x, $y, $w, scalar @lines);
-\& $self->scr_overlay_set (0, $_, $lines[$_]) for 0.. $#lines;
-\&}
-.Ve
+#
+#sub urxvt::term::scr_overlay {
+# my ($self, \f(CW$x\fR, \f(CW$y\fR, \f(CW$text\fR) = \f(CW@_\fR;
+#
+# my \f(CW@lines\fR = split /\en/, \f(CW$text\fR;
+#
+# my \f(CW$w\fR = 0;
+# for (map \f(CW$self\fR\->strwidth ($_), \f(CW@lines\fR) {
+# \f(CW$w\fR = \f(CW$_\fR if \f(CW$w\fR < \f(CW$_\fR;
+# }
+#
+# \f(CW$self\fR\->scr_overlay_new ($x, \f(CW$y\fR, \f(CW$w\fR, scalar \f(CW@lines\fR);
+# \f(CW$self\fR\->scr_overlay_set (0, \f(CW$_\fR, \f(CW$lines\fR[$_]) for 0.. $#lines;
+#}
.ie n .IP "$term\->overlay ($x, $y\fR, \f(CW$width\fR, \f(CW$height\fR[, \f(CW$rstyle\fR[, \f(CW$border]])" 4
.el .IP "$term\->overlay ($x, \f(CW$y\fR, \f(CW$width\fR, \f(CW$height\fR[, \f(CW$rstyle\fR[, \f(CW$border\fR]])" 4
.IX Item "$term->overlay ($x, $y, $width, $height[, $rstyle[, $border]])"
.RE
.RS 4
.RE
-.ie n .IP "$cellwidth = $term\fR\->strwidth \f(CW$string" 4
-.el .IP "$cellwidth = \f(CW$term\fR\->strwidth \f(CW$string\fR" 4
-.IX Item "$cellwidth = $term->strwidth $string"
+.ie n .IP "$cellwidth = $term\->strwidth ($string)" 4
+.el .IP "$cellwidth = \f(CW$term\fR\->strwidth ($string)" 4
+.IX Item "$cellwidth = $term->strwidth ($string)"
Returns the number of screen-cells this string would need. Correctly
accounts for wide and combining characters.
-.ie n .IP "$octets = $term\fR\->locale_encode \f(CW$string" 4
-.el .IP "$octets = \f(CW$term\fR\->locale_encode \f(CW$string\fR" 4
-.IX Item "$octets = $term->locale_encode $string"
+.ie n .IP "$octets = $term\->locale_encode ($string)" 4
+.el .IP "$octets = \f(CW$term\fR\->locale_encode ($string)" 4
+.IX Item "$octets = $term->locale_encode ($string)"
Convert the given text string into the corresponding locale encoding.
-.ie n .IP "$string = $term\fR\->locale_decode \f(CW$octets" 4
-.el .IP "$string = \f(CW$term\fR\->locale_decode \f(CW$octets\fR" 4
-.IX Item "$string = $term->locale_decode $octets"
+.ie n .IP "$string = $term\->locale_decode ($octets)" 4
+.el .IP "$string = \f(CW$term\fR\->locale_decode ($octets)" 4
+.IX Item "$string = $term->locale_decode ($octets)"
Convert the given locale-encoded octets into a perl string.
+.IP "$term\->scr_add_lines ($string)" 4
+.IX Item "$term->scr_add_lines ($string)"
+Write the given text string to the screen, as if output by the application
+running inside the terminal. It may not contain command sequences (escape
+codes), but is free to use line feeds, carriage returns and tabs. The
+string is a normal text string, not in locale-dependent encoding.
+.Sp
+Normally its not a good idea to use this function, as programs might be
+confused by changes in cursor position or scrolling. Its useful inside a
+\&\f(CW\*(C`on_add_lines\*(C'\fR hook, though.
+.IP "$term\->cmd_parse ($octets)" 4
+.IX Item "$term->cmd_parse ($octets)"
+Similar to \f(CW\*(C`scr_add_lines\*(C'\fR, but the argument must be in the
+locale-specific encoding of the terminal and can contain command sequences
+(escape codes) that will be interpreted.
.IP "$term\->tt_write ($octets)" 4
.IX Item "$term->tt_write ($octets)"
Write the octets given in \f(CW$data\fR to the tty (i.e. as program input). To
pass characters instead of octets, you should convert your strings first
to the locale-specific encoding using \f(CW\*(C`$term\->locale_encode\*(C'\fR.
+.ie n .IP "$windowid = $term\->parent" 4
+.el .IP "$windowid = \f(CW$term\fR\->parent" 4
+.IX Item "$windowid = $term->parent"
+Return the window id of the toplevel window.
+.ie n .IP "$windowid = $term\->vt" 4
+.el .IP "$windowid = \f(CW$term\fR\->vt" 4
+.IX Item "$windowid = $term->vt"
+Return the window id of the terminal window.
.ie n .IP "$window_width = $term\->width" 4
.el .IP "$window_width = \f(CW$term\fR\->width" 4
.IX Item "$window_width = $term->width"
about the logical line that row \f(CW$row_number\fR is part of. It supports the
following methods:
.RS 4
-.ie n .IP "$text = $line\->t" 4
-.el .IP "$text = \f(CW$line\fR\->t" 4
-.IX Item "$text = $line->t"
-Returns the full text of the line, similar to \f(CW\*(C`ROW_t\*(C'\fR
-.ie n .IP "$rend = $line\->r" 4
-.el .IP "$rend = \f(CW$line\fR\->r" 4
-.IX Item "$rend = $line->r"
-Returns the full rendition array of the line, similar to \f(CW\*(C`ROW_r\*(C'\fR
+.ie n .IP "$text = $line\->t ([$new_text])" 4
+.el .IP "$text = \f(CW$line\fR\->t ([$new_text])" 4
+.IX Item "$text = $line->t ([$new_text])"
+Returns or replaces the full text of the line, similar to \f(CW\*(C`ROW_t\*(C'\fR
+.ie n .IP "$rend = $line\->r ([$new_rend])" 4
+.el .IP "$rend = \f(CW$line\fR\->r ([$new_rend])" 4
+.IX Item "$rend = $line->r ([$new_rend])"
+Returns or replaces the full rendition array of the line, similar to \f(CW\*(C`ROW_r\*(C'\fR
.ie n .IP "$length = $line\->l" 4
.el .IP "$length = \f(CW$line\fR\->l" 4
.IX Item "$length = $line->l"
digital-clock
Displays a digital clock using the built-in overlay.
+ mark-urls
+ Uses per-line display filtering ("on_line_update") to underline
+ urls.
+
+ block-graphics-to-ascii
+ A not very useful example of filtering all text output to the
+ terminal, by replacing all line-drawing characters (U+2500 ..
+ U+259F) by a similar-looking ascii character.
+
example-refresh-hooks
Displays a very simple digital clock in the upper right corner of
the window. Illustrates overwriting the refresh callbacks to create
the like inside the terminal object so they get destroyed as soon as the
terminal is destroyed.
+ Argument names also often indicate the type of a parameter. Here are
+ some hints on what they mean:
+
+ $text
+ Rxvt-unicodes special way of encoding text, where one "unicode"
+ character always represents one screen cell. See row_t for a
+ discussion of this format.
+
+ $string
+ A perl text string, with an emphasis on *text*. It can store all
+ unicode characters and is to be distinguished with text encoded in a
+ specific encoding (often locale-specific) and binary data.
+
+ $octets
+ Either binary data or - more common - a text string encoded in a
+ locale-specific way.
+
Hooks
- The following subroutines can be declared in loaded scripts, and will be
- called whenever the relevant event happens.
+ The following subroutines can be declared in extension files, and will
+ be called whenever the relevant event happens.
The first argument passed to them is an object private to each terminal
and extension package. You can call all "urxvt::term" methods on it, but
on_init $term
Called after a new terminal object has been initialized, but before
- windows are created or the command gets run.
+ windows are created or the command gets run. Most methods are unsafe
+ to call or deliver senseless data, as terminal size and other
+ characteristics have not yet been determined. You can safely query
+ and change resources, though.
on_reset $term
Called after the screen is "reset" for any reason, such as resizing
receive, as its source can not easily be controleld (e-mail content,
messages from other users on the same system etc.).
+ on_add_lines $term, $string
+ Called whenever text is about to be output, with the text as
+ argument. You can filter/change and output the text yourself by
+ returning a true value and calling "$term->scr_add_lines" yourself.
+ Please note that this might be very slow, however, as your hook is
+ called for all text being output.
+
+ on_line_update $term, $row
+ Called whenever a line was updated or changed. Can be used to filter
+ screen output (e.g. underline urls or other useless stuff). Only
+ lines that are being shown will be filtered, and, due to performance
+ reasons, not always immediately.
+
+ The row number is always the topmost row of the line if the line
+ spans multiple rows.
+
+ Please note that, if you change the line, then the hook might get
+ called later with the already-modified line (e.g. if unrelated parts
+ change), so you cannot just toggle rendition bits, but only set
+ them.
+
on_refresh_begin $term
Called just before the screen gets redrawn. Can be used for overlay
or similar effects by modify terminal contents in refresh_begin, and
"perl:string" action bound to it (see description of the keysym
resource in the rxvt(1) manpage).
+ on_key_press $term, $event, $octets
+ on_key_release $term, $event
+ on_button_press $term, $event
+ on_button_release $term, $event
+ on_motion_notify $term, $event
+ Called whenever the corresponding X event is received for the
+ terminal If the hook returns true, then the even will be ignored by
+ rxvt-unicode.
+
+ The event is a hash with most values as named by Xlib (see the
+ XEvent manpage), with the additional members "row" and "col", which
+ are the row and column under the mouse cursor.
+
+ "on_key_press" additionally receives the string rxvt-unicode would
+ output, if any, in locale-specific encoding.
+
+ subwindow.
+
Variables in the "urxvt" Package
$urxvt::TERM
- The current terminal. Whenever a callback/Hook is bein executed,
- this variable stores the current "urxvt::term" object.
+ The current terminal. This variable stores the current "urxvt::term"
+ object, whenever a callback/hook is executing.
Functions in the "urxvt" Package
+ $term = new urxvt [arg...]
+ Creates a new terminal, very similar as if you had started it with
+ "system $binfile, arg...". Croaks (and probably outputs an error
+ message) if the new instance couldn't be created. Returns "undef" if
+ the new instance didn't initialise perl, and the terminal object
+ otherwise. The "init" and "start" hooks will be called during the
+ call.
+
urxvt::fatal $errormessage
Fatally aborts execution with the given error message. Avoid at all
costs! The only time this is acceptable is when the terminal process
Change the custom value.
The "urxvt::term" Class
+ $term->destroy
+ Destroy the terminal object (close the window, free resources etc.).
+
$value = $term->resource ($name[, $newval])
Returns the current resource value associated with a given name and
optionally sets a new value. Setting values is most useful in the
shade term_name title transparent transparent_all tripleclickwords
utmpInhibit visualBell
- $rend = $term->screen_rstyle ([$new_rstyle])
- Return and optionally change the current rendition. Text thta is
- output by the temrianl application will use this style.
+ $rend = $term->rstyle ([$new_rstyle])
+ Return and optionally change the current rendition. Text that is
+ output by the terminal application will use this style.
($row, $col) = $term->screen_cur ([$row, $col])
Return the current coordinates of the text cursor position and
$newtext.
#=item $term->overlay ($x, $y, $text) # #Create a simple multi-line
- overlay box. See the next method for details. # #=cut
-
- sub urxvt::term::scr_overlay { die; my ($self, $x, $y, $text) = @_;
-
- my @lines = split /\n/, $text;
-
- my $w = 0;
- for (map $self->strwidth ($_), @lines) {
- $w = $_ if $w < $_;
- }
-
- $self->scr_overlay_new ($x, $y, $w, scalar @lines);
- $self->scr_overlay_set (0, $_, $lines[$_]) for 0.. $#lines;
- }
+ overlay box. See the next method for details. # #=cut # #sub
+ urxvt::term::scr_overlay { # my ($self, $x, $y, $text) = @_; # # my
+ @lines = split /\n/, $text; # # my $w = 0; # for (map
+ $self->strwidth ($_), @lines) { # $w = $_ if $w < $_; # } # #
+ $self->scr_overlay_new ($x, $y, $w, scalar @lines); #
+ $self->scr_overlay_set (0, $_, $lines[$_]) for 0.. $#lines; #}
$term->overlay ($x, $y, $width, $height[, $rstyle[, $border]])
Create a new (empty) overlay at the given position with the given
$overlay->show
If hidden, display the overlay again.
- $cellwidth = $term->strwidth $string
+ $cellwidth = $term->strwidth ($string)
Returns the number of screen-cells this string would need. Correctly
accounts for wide and combining characters.
- $octets = $term->locale_encode $string
+ $octets = $term->locale_encode ($string)
Convert the given text string into the corresponding locale
encoding.
- $string = $term->locale_decode $octets
+ $string = $term->locale_decode ($octets)
Convert the given locale-encoded octets into a perl string.
+ $term->scr_add_lines ($string)
+ Write the given text string to the screen, as if output by the
+ application running inside the terminal. It may not contain command
+ sequences (escape codes), but is free to use line feeds, carriage
+ returns and tabs. The string is a normal text string, not in
+ locale-dependent encoding.
+
+ Normally its not a good idea to use this function, as programs might
+ be confused by changes in cursor position or scrolling. Its useful
+ inside a "on_add_lines" hook, though.
+
+ $term->cmd_parse ($octets)
+ Similar to "scr_add_lines", but the argument must be in the
+ locale-specific encoding of the terminal and can contain command
+ sequences (escape codes) that will be interpreted.
+
$term->tt_write ($octets)
Write the octets given in $data to the tty (i.e. as program input).
To pass characters instead of octets, you should convert your
strings first to the locale-specific encoding using
"$term->locale_encode".
+ $windowid = $term->parent
+ Return the window id of the toplevel window.
+
+ $windowid = $term->vt
+ Return the window id of the terminal window.
+
$window_width = $term->width
$window_height = $term->height
$font_width = $term->fwidth
about the logical line that row $row_number is part of. It supports
the following methods:
- $text = $line->t
- Returns the full text of the line, similar to "ROW_t"
+ $text = $line->t ([$new_text])
+ Returns or replaces the full text of the line, similar to
+ "ROW_t"
- $rend = $line->r
- Returns the full rendition array of the line, similar to "ROW_r"
+ $rend = $line->r ([$new_rend])
+ Returns or replaces the full rendition array of the line,
+ similar to "ROW_r"
$length = $line->l
Returns the length of the line in cells, similar to "ROW_l".
void
rxvt_term::destroy ()
+void
+rxvt_term::grab (int eventtime)
+ CODE:
+{
+return;
+ XGrabPointer (THIS->display->display, THIS->vt, 0,
+ ButtonPressMask | ButtonReleaseMask | EnterWindowMask | LeaveWindowMask | PointerMotionMask,
+ GrabModeAsync, GrabModeAsync, None, None, eventtime);
+ XGrabKeyboard (THIS->display->display, THIS->vt, 0, GrabModeAsync, GrabModeAsync, eventtime);
+}
+
int
rxvt_term::strwidth (SV *str)
CODE:
THIS->cmdbuf_ptr = str;
THIS->cmdbuf_endp = str + len;
+ rxvt_push_locale (THIS->locale);
THIS->cmd_parse ();
+ rxvt_pop_locale ();
THIS->cmdbuf_ptr = old_cmdbuf_ptr;
THIS->cmdbuf_endp = old_cmdbuf_endp;
=head2 Hooks
-The following subroutines can be declared in loaded scripts, and will be
+The following subroutines can be declared in extension files, and will be
called whenever the relevant event happens.
The first argument passed to them is an object private to each terminal
=item $urxvt::TERM
-The current terminal. Whenever a callback/Hook is bein executed, this
-variable stores the current C<urxvt::term> object.
+The current terminal. This variable stores the current C<urxvt::term>
+object, whenever a callback/hook is executing.
=back