… | |
… | |
15 | <li><a href="#name">NAME</a></li> |
15 | <li><a href="#name">NAME</a></li> |
16 | <li><a href="#synopsis">SYNOPSIS</a></li> |
16 | <li><a href="#synopsis">SYNOPSIS</a></li> |
17 | <li><a href="#description">DESCRIPTION</a></li> |
17 | <li><a href="#description">DESCRIPTION</a></li> |
18 | <ul> |
18 | <ul> |
19 | |
19 | |
|
|
20 | <li><a href="#general_api_considerations">General API Considerations</a></li> |
20 | <li><a href="#hooks">Hooks</a></li> |
21 | <li><a href="#hooks">Hooks</a></li> |
21 | <li><a href="#functions_in_the_urxvt_package">Functions in the <code>urxvt</code> Package</a></li> |
22 | <li><a href="#functions_in_the_urxvt_package">Functions in the <code>urxvt</code> Package</a></li> |
22 | <li><a href="#the_urxvt__term_class">The <code>urxvt::term</code> Class</a></li> |
23 | <li><a href="#the_urxvt__term_class">The <code>urxvt::term</code> Class</a></li> |
23 | <li><a href="#the_urxvt__timer_class">The <code>urxvt::timer</code> Class</a></li> |
24 | <li><a href="#the_urxvt__timer_class">The <code>urxvt::timer</code> Class</a></li> |
24 | <li><a href="#the_urxvt__iow_class">The <code>urxvt::iow</code> Class</a></li> |
25 | <li><a href="#the_urxvt__iow_class">The <code>urxvt::iow</code> Class</a></li> |
… | |
… | |
41 | <p>rxvtperl - rxvt-unicode's embedded perl interpreter</p> |
42 | <p>rxvtperl - rxvt-unicode's embedded perl interpreter</p> |
42 | <p> |
43 | <p> |
43 | </p> |
44 | </p> |
44 | <hr /> |
45 | <hr /> |
45 | <h1><a name="synopsis">SYNOPSIS</a></h1> |
46 | <h1><a name="synopsis">SYNOPSIS</a></h1> |
46 | <p>* Put your scripts into <em>/opt/rxvt/lib/urxvt/perl-ext/</em>, they will be loaded automatically.</p> |
47 | <pre> |
47 | <p>* Each script will only be loaded once, even in urxvtd, and will be valid |
48 | # create a file grab_test in $HOME:</pre> |
48 | globally.</p> |
|
|
49 | <p>* Scripts are evaluated in a 'use strict' and 'use utf8' environment, and |
|
|
50 | thus must be encoded as UTF-8.</p> |
|
|
51 | <pre> |
49 | <pre> |
52 | sub on_sel_grab { |
50 | sub on_sel_grab { |
53 | warn "you selected ", $_[0]->selection; |
51 | warn "you selected ", $_[0]->selection; |
54 | () |
52 | () |
55 | }</pre> |
53 | }</pre> |
56 | <pre> |
54 | <pre> |
57 | 1</pre> |
55 | # start a rxvt using it:</pre> |
|
|
56 | <pre> |
|
|
57 | rxvt --perl-lib $HOME -pe grab_test</pre> |
58 | <p> |
58 | <p> |
59 | </p> |
59 | </p> |
60 | <hr /> |
60 | <hr /> |
61 | <h1><a name="description">DESCRIPTION</a></h1> |
61 | <h1><a name="description">DESCRIPTION</a></h1> |
|
|
62 | <p>Everytime a terminal object gets created, scripts specified via the |
|
|
63 | <code>perl</code> resource are loaded and associated with it.</p> |
|
|
64 | <p>Scripts are compiled in a 'use strict' and 'use utf8' environment, and |
|
|
65 | thus must be encoded as UTF-8.</p> |
|
|
66 | <p>Each script will only ever be loaded once, even in rxvtd, where |
|
|
67 | scripts will be shared (But not enabled) for all terminals.</p> |
|
|
68 | <p> |
|
|
69 | </p> |
|
|
70 | <h2><a name="general_api_considerations">General API Considerations</a></h2> |
|
|
71 | <p>All objects (such as terminals, time watchers etc.) are typical |
|
|
72 | reference-to-hash objects. The hash can be used to store anything you |
|
|
73 | like. All members starting with an underscore (such as <code>_ptr</code> or |
|
|
74 | <code>_hook</code>) are reserved for internal uses and must not be accessed or |
|
|
75 | modified).</p> |
|
|
76 | <p>When objects are destroyed on the C++ side, the perl object hashes are |
|
|
77 | emptied, so its best to store related objects such as time watchers and |
|
|
78 | the like inside the terminal object so they get destroyed as soon as the |
|
|
79 | terminal is destroyed.</p> |
62 | <p> |
80 | <p> |
63 | </p> |
81 | </p> |
64 | <h2><a name="hooks">Hooks</a></h2> |
82 | <h2><a name="hooks">Hooks</a></h2> |
65 | <p>The following subroutines can be declared in loaded scripts, and will be called |
83 | <p>The following subroutines can be declared in loaded scripts, and will be called |
66 | whenever the relevant event happens.</p> |
84 | whenever the relevant event happens.</p> |
… | |
… | |
167 | <dt><strong><a name="item_on_refresh_end__24term">on_refresh_end $term</a></strong><br /> |
185 | <dt><strong><a name="item_on_refresh_end__24term">on_refresh_end $term</a></strong><br /> |
168 | </dt> |
186 | </dt> |
169 | <dd> |
187 | <dd> |
170 | Called just after the screen gets redrawn. See <code>on_refresh_begin</code>. |
188 | Called just after the screen gets redrawn. See <code>on_refresh_begin</code>. |
171 | </dd> |
189 | </dd> |
|
|
190 | <p></p> |
|
|
191 | <dt><strong><a name="item_on_keyboard_command__24term_2c__24string">on_keyboard_command $term, $string</a></strong><br /> |
|
|
192 | </dt> |
|
|
193 | <dd> |
|
|
194 | Called whenever the user presses a key combination that has a |
|
|
195 | <code>perl:string</code> action bound to it (see description of the <strong>keysym</strong> |
|
|
196 | resource in the <code>rxvt(1)</code> manpage). |
|
|
197 | </dd> |
172 | <p></p></dl> |
198 | <p></p></dl> |
173 | <p> |
199 | <p> |
174 | </p> |
200 | </p> |
175 | <h2><a name="functions_in_the_urxvt_package">Functions in the <code>urxvt</code> Package</a></h2> |
201 | <h2><a name="functions_in_the_urxvt_package">Functions in the <code>urxvt</code> Package</a></h2> |
176 | <dl> |
202 | <dl> |
… | |
… | |
183 | </dd> |
209 | </dd> |
184 | <p></p> |
210 | <p></p> |
185 | <dt><strong><a name="item_urxvt_3a_3awarn__24string">urxvt::warn $string</a></strong><br /> |
211 | <dt><strong><a name="item_urxvt_3a_3awarn__24string">urxvt::warn $string</a></strong><br /> |
186 | </dt> |
212 | </dt> |
187 | <dd> |
213 | <dd> |
188 | Calls <code>rxvt_warn</code> witht eh given string which should not include a |
214 | Calls <code>rxvt_warn</code> with the given string which should not include a |
189 | newline. The module also overwrites the <code>warn</code> builtin with a function |
215 | newline. The module also overwrites the <code>warn</code> builtin with a function |
190 | that calls this function. |
216 | that calls this function. |
191 | </dd> |
217 | </dd> |
192 | <dd> |
218 | <dd> |
193 | <p>Using this function has the advantage that its output ends up in the |
219 | <p>Using this function has the advantage that its output ends up in the |
194 | correct place, e.g. on stderr of the connecting urxvtc client.</p> |
220 | correct place, e.g. on stderr of the connecting urxvtc client.</p> |
195 | </dd> |
|
|
196 | <p></p> |
|
|
197 | <dt><strong><a name="item__24cellwidth__3d_urxvt_3a_3awcswidth__24string">$cellwidth = urxvt::wcswidth $string</a></strong><br /> |
|
|
198 | </dt> |
|
|
199 | <dd> |
|
|
200 | Returns the number of screen-cells this string would need. Correctly |
|
|
201 | accounts for wide and combining characters. |
|
|
202 | </dd> |
221 | </dd> |
203 | <p></p> |
222 | <p></p> |
204 | <dt><strong><a name="item__24time__3d_urxvt_3a_3anow">$time = urxvt::NOW</a></strong><br /> |
223 | <dt><strong><a name="item__24time__3d_urxvt_3a_3anow">$time = urxvt::NOW</a></strong><br /> |
205 | </dt> |
224 | </dt> |
206 | <dd> |
225 | <dd> |
… | |
… | |
241 | <pre> |
260 | <pre> |
242 | answerbackstring backgroundPixmap backspace_key boldFont boldItalicFont |
261 | answerbackstring backgroundPixmap backspace_key boldFont boldItalicFont |
243 | borderLess color cursorBlink cursorUnderline cutchars delete_key |
262 | borderLess color cursorBlink cursorUnderline cutchars delete_key |
244 | display_name embed ext_bwidth fade font geometry hold iconName |
263 | display_name embed ext_bwidth fade font geometry hold iconName |
245 | imFont imLocale inputMethod insecure int_bwidth intensityStyles |
264 | imFont imLocale inputMethod insecure int_bwidth intensityStyles |
246 | italicFont jumpScroll lineSpace loginShell mapAlert menu meta8 |
265 | italicFont jumpScroll lineSpace loginShell mapAlert menu meta8 modifier |
247 | modifier mouseWheelScrollPage name pastableTabs path pointerBlank |
266 | mouseWheelScrollPage name pastableTabs path perl_eval perl_ext |
248 | pointerBlankDelay preeditType print_pipe pty_fd reverseVideo saveLines |
267 | perl_lib pointerBlank pointerBlankDelay preeditType print_pipe pty_fd |
249 | scrollBar scrollBar_align scrollBar_floating scrollBar_right |
268 | reverseVideo saveLines scrollBar scrollBar_align scrollBar_floating |
250 | scrollBar_thickness scrollTtyKeypress scrollTtyOutput scrollWithBuffer |
269 | scrollBar_right scrollBar_thickness scrollTtyKeypress scrollTtyOutput |
251 | scrollstyle secondaryScreen secondaryScroll selectstyle shade term_name |
270 | scrollWithBuffer scrollstyle secondaryScreen secondaryScroll selectstyle |
252 | title transparent transparent_all tripleclickwords utmpInhibit |
271 | shade term_name title transparent transparent_all tripleclickwords |
253 | visualBell</pre> |
272 | utmpInhibit visualBell</pre> |
254 | </dd> |
273 | </dd> |
255 | <p></p> |
274 | <p></p> |
256 | <dt><strong><a name="item_selection_mark">($row, $col) = $term->selection_mark ([$row, $col])</a></strong><br /> |
275 | <dt><strong><a name="item_selection_mark">($row, $col) = $term->selection_mark ([$row, $col])</a></strong><br /> |
257 | </dt> |
276 | </dt> |
258 | <dt><strong><a name="item_selection_beg">($row, $col) = $term->selection_beg ([$row, $col])</a></strong><br /> |
277 | <dt><strong><a name="item_selection_beg">($row, $col) = $term->selection_beg ([$row, $col])</a></strong><br /> |
… | |
… | |
307 | <p></p> |
326 | <p></p> |
308 | <dt><strong><a name="item_scr_overlay_set">$term->scr_overlay_set ($x, $y, $text)</a></strong><br /> |
327 | <dt><strong><a name="item_scr_overlay_set">$term->scr_overlay_set ($x, $y, $text)</a></strong><br /> |
309 | </dt> |
328 | </dt> |
310 | <dd> |
329 | <dd> |
311 | Write a string at the given position into the overlay. |
330 | Write a string at the given position into the overlay. |
|
|
331 | </dd> |
|
|
332 | <p></p> |
|
|
333 | <dt><strong><a name="item_strwidth">$cellwidth = $term->strwidth $string</a></strong><br /> |
|
|
334 | </dt> |
|
|
335 | <dd> |
|
|
336 | Returns the number of screen-cells this string would need. Correctly |
|
|
337 | accounts for wide and combining characters. |
|
|
338 | </dd> |
|
|
339 | <p></p> |
|
|
340 | <dt><strong><a name="item_locale_encode">$octets = $term->locale_encode $string</a></strong><br /> |
|
|
341 | </dt> |
|
|
342 | <dd> |
|
|
343 | Convert the given text string into the corresponding locale encoding. |
|
|
344 | </dd> |
|
|
345 | <p></p> |
|
|
346 | <dt><strong><a name="item_locale_decode">$string = $term->locale_decode $octets</a></strong><br /> |
|
|
347 | </dt> |
|
|
348 | <dd> |
|
|
349 | Convert the given locale-encoded octets into a perl string. |
|
|
350 | </dd> |
|
|
351 | <p></p> |
|
|
352 | <dt><strong><a name="item_tt_write">$term->tt_write ($octets)</a></strong><br /> |
|
|
353 | </dt> |
|
|
354 | <dd> |
|
|
355 | Write the octets given in <code>$data</code> to the tty (i.e. as program input). To |
|
|
356 | pass characters instead of octets, you should convetr you strings first to |
|
|
357 | the locale-specific encoding using <a href="#item_locale_encode"><code>$term->locale_encode</code></a>. |
312 | </dd> |
358 | </dd> |
313 | <p></p></dl> |
359 | <p></p></dl> |
314 | <p> |
360 | <p> |
315 | </p> |
361 | </p> |
316 | <h2><a name="the_urxvt__timer_class">The <code>urxvt::timer</code> Class</a></h2> |
362 | <h2><a name="the_urxvt__timer_class">The <code>urxvt::timer</code> Class</a></h2> |