1 | NAME |
1 | NAME |
2 | rxvtperl - rxvt-unicode's embedded perl interpreter |
2 | rxvtperl - rxvt-unicode's embedded perl interpreter |
3 | |
3 | |
4 | SYNOPSIS |
4 | SYNOPSIS |
5 | * Put your scripts into /opt/rxvt/lib/urxvt/perl-ext/, they will be |
5 | # create a file grab_test in $HOME: |
6 | loaded automatically. |
|
|
7 | |
|
|
8 | * Scripts are evaluated in a 'use strict' and 'use utf8' environment, |
|
|
9 | and thus must be encoded as UTF-8. |
|
|
10 | |
6 | |
11 | sub on_sel_grab { |
7 | sub on_sel_grab { |
12 | warn "you selected ", $_[0]->selection; |
8 | warn "you selected ", $_[0]->selection; |
13 | () |
9 | () |
14 | } |
10 | } |
15 | |
11 | |
16 | 1 |
12 | # start a rxvt using it: |
|
|
13 | |
|
|
14 | rxvt --perl-lib $HOME -pe grab_test |
17 | |
15 | |
18 | DESCRIPTION |
16 | DESCRIPTION |
19 | Everytime a terminal object gets created, scripts specified via the |
17 | Everytime a terminal object gets created, scripts specified via the |
20 | "perl" resource are associated with it. |
18 | "perl" resource are loaded and associated with it. |
|
|
19 | |
|
|
20 | Scripts are compiled in a 'use strict' and 'use utf8' environment, and |
|
|
21 | thus must be encoded as UTF-8. |
21 | |
22 | |
22 | Each script will only ever be loaded once, even in rxvtd, where scripts |
23 | Each script will only ever be loaded once, even in rxvtd, where scripts |
23 | will be shared (But not enabled) for all terminals. |
24 | will be shared (But not enabled) for all terminals. |
|
|
25 | |
|
|
26 | PACKAGED EXTENSIONS |
|
|
27 | This section describes the extensiosn delivered with this version. You |
|
|
28 | can find them in /opt/rxvt/lib/urxvt/perl/. |
|
|
29 | |
|
|
30 | You can activate them like this: |
|
|
31 | |
|
|
32 | rxvt -pe <extensionname> |
|
|
33 | |
|
|
34 | selection |
|
|
35 | Miscellaneous selection modifications. |
|
|
36 | |
|
|
37 | rot13 |
|
|
38 | Rot-13 the selection when activated. Used via keyboard trigger: |
|
|
39 | |
|
|
40 | URxvt.keysym.C-M-r: perl:selection:rot13 |
|
|
41 | |
|
|
42 | digital-clock |
|
|
43 | Displays a very simple digital clock in the upper right corner of |
|
|
44 | the window. Illustrates overwriting the refresh callbacks to create |
|
|
45 | your own overlays or changes. |
|
|
46 | |
|
|
47 | simple-overlay-clock |
|
|
48 | Displays a digital clock using the built-in overlay (colorful, |
|
|
49 | useless). |
24 | |
50 | |
25 | General API Considerations |
51 | General API Considerations |
26 | All objects (such as terminals, time watchers etc.) are typical |
52 | All objects (such as terminals, time watchers etc.) are typical |
27 | reference-to-hash objects. The hash can be used to store anything you |
53 | reference-to-hash objects. The hash can be used to store anything you |
28 | like. All members starting with an underscore (such as "_ptr" or |
54 | like. All members starting with an underscore (such as "_ptr" or |
… | |
… | |
107 | restoring them in refresh_end. The built-in overlay and selection |
133 | restoring them in refresh_end. The built-in overlay and selection |
108 | display code is run after this hook, and takes precedence. |
134 | display code is run after this hook, and takes precedence. |
109 | |
135 | |
110 | on_refresh_end $term |
136 | on_refresh_end $term |
111 | Called just after the screen gets redrawn. See "on_refresh_begin". |
137 | Called just after the screen gets redrawn. See "on_refresh_begin". |
|
|
138 | |
|
|
139 | on_keyboard_command $term, $string |
|
|
140 | Called whenever the user presses a key combination that has a |
|
|
141 | "perl:string" action bound to it (see description of the keysym |
|
|
142 | resource in the rxvt(1) manpage). |
112 | |
143 | |
113 | Functions in the "urxvt" Package |
144 | Functions in the "urxvt" Package |
114 | urxvt::fatal $errormessage |
145 | urxvt::fatal $errormessage |
115 | Fatally aborts execution with the given error message. Avoid at all |
146 | Fatally aborts execution with the given error message. Avoid at all |
116 | costs! The only time this is acceptable is when the terminal process |
147 | costs! The only time this is acceptable is when the terminal process |
… | |
… | |
207 | $string = $term->locale_decode $octets |
238 | $string = $term->locale_decode $octets |
208 | Convert the given locale-encoded octets into a perl string. |
239 | Convert the given locale-encoded octets into a perl string. |
209 | |
240 | |
210 | $term->tt_write ($octets) |
241 | $term->tt_write ($octets) |
211 | Write the octets given in $data to the tty (i.e. as program input). |
242 | Write the octets given in $data to the tty (i.e. as program input). |
212 | To pass characters instead of octets, you should convetr you strings |
243 | To pass characters instead of octets, you should convert your |
213 | first to the locale-specific encoding using "$term->locale_encode". |
244 | strings first to the locale-specific encoding using |
|
|
245 | "$term->locale_encode". |
|
|
246 | |
|
|
247 | $nrow = $term->nrow |
|
|
248 | $ncol = $term->ncol |
|
|
249 | Return the number of rows/columns of the terminal window (i.e. as |
|
|
250 | specified by "-geometry", excluding any scrollback). |
|
|
251 | |
|
|
252 | $nsaved = $term->nsaved |
|
|
253 | Returns the number of lines in the scrollback buffer. |
|
|
254 | |
|
|
255 | $view_start = $term->view_start ([$newvalue]) |
|
|
256 | Returns the negative row number of the topmost line. Minimum value |
|
|
257 | is 0, which displays the normal terminal contents. Larger values |
|
|
258 | scroll this many lines into the scrollback buffer. |
|
|
259 | |
|
|
260 | $term->want_refresh |
|
|
261 | Requests a screen refresh. At the next opportunity, rxvt-unicode |
|
|
262 | will compare the on-screen display with its stored representation. |
|
|
263 | If they differ, it redraws the differences. |
|
|
264 | |
|
|
265 | Used after changing terminal contents to display them. |
|
|
266 | |
|
|
267 | $text = $term->ROW_t ($row_number[, $new_text[, $start_col]]) |
|
|
268 | Returns the text of the entire row with number $row_number. Row 0 is |
|
|
269 | the topmost terminal line, row "$term->$ncol-1" is the bottommost |
|
|
270 | terminal line. The scrollback buffer starts at line -1 and extends |
|
|
271 | to line "-$term->nsaved". |
|
|
272 | |
|
|
273 | If $new_text is specified, it will replace characters in the current |
|
|
274 | line, starting at column $start_col (default 0), which is useful to |
|
|
275 | replace only parts of a line. The font iindex in the rendition will |
|
|
276 | automatically be updated. |
|
|
277 | |
|
|
278 | $text is in a special encoding: tabs and wide characters that use |
|
|
279 | more than one cell when displayed are padded with urxvt::NOCHAR |
|
|
280 | characters ("chr 65535"). Characters with combining characters and |
|
|
281 | other characters that do not fit into the normal tetx encoding will |
|
|
282 | be replaced with characters in the private use area. |
|
|
283 | |
|
|
284 | You have to obey this encoding when changing text. The advantage is |
|
|
285 | that "substr" and similar functions work on screen cells and not on |
|
|
286 | characters. |
|
|
287 | |
|
|
288 | The methods "$term->special_encode" and "$term->special_decode" can |
|
|
289 | be used to convert normal strings into this encoding and vice versa. |
|
|
290 | |
|
|
291 | $rend = $term->ROW_r ($row_number[, $new_rend[, $start_col]]) |
|
|
292 | Like "$term->ROW_t", but returns an arrayref with rendition bitsets. |
|
|
293 | Rendition bitsets contain information about colour, font, font |
|
|
294 | styles and similar information. See also "$term->ROW_t". |
|
|
295 | |
|
|
296 | When setting rendition, the font mask will be ignored. |
|
|
297 | |
|
|
298 | See the section on RENDITION, below. |
|
|
299 | |
|
|
300 | $length = $term->ROW_l ($row_number[, $new_length]) |
|
|
301 | Returns the number of screen cells that are in use ("the line |
|
|
302 | length"). If it is -1, then the line is part of a multiple-row |
|
|
303 | logical "line", which means all characters are in use and it is |
|
|
304 | continued on the next row. |
|
|
305 | |
|
|
306 | $text = $term->special_encode $string |
|
|
307 | Converts a perl string into the special encoding used by |
|
|
308 | rxvt-unicode, where one character corresponds to one screen cell. |
|
|
309 | See "$term->ROW_t" for details. |
|
|
310 | |
|
|
311 | $string = $term->special_decode $text |
|
|
312 | Converts rxvt-unicodes text reprsentation into a perl string. See |
|
|
313 | "$term->ROW_t" for details. |
|
|
314 | |
|
|
315 | RENDITION |
|
|
316 | Rendition bitsets contain information about colour, font, font styles |
|
|
317 | and similar information for each screen cell. |
|
|
318 | |
|
|
319 | The following "macros" deal with changes in rendition sets. You should |
|
|
320 | never just create a bitset, you should always modify an existing one, as |
|
|
321 | they contain important information required for correct operation of |
|
|
322 | rxvt-unicode. |
|
|
323 | |
|
|
324 | $rend = urxvt::DEFAULT_RSTYLE |
|
|
325 | Returns the default rendition, as used when the terminal is starting |
|
|
326 | up or being reset. Useful as a base |
214 | |
327 | |
215 | The "urxvt::timer" Class |
328 | The "urxvt::timer" Class |
216 | This class implements timer watchers/events. Time is represented as a |
329 | This class implements timer watchers/events. Time is represented as a |
217 | fractional number of seconds since the epoch. Example: |
330 | fractional number of seconds since the epoch. Example: |
218 | |
331 | |