… | |
… | |
28 | can find them in /opt/rxvt/lib/urxvt/perl/. |
28 | can find them in /opt/rxvt/lib/urxvt/perl/. |
29 | |
29 | |
30 | You can activate them like this: |
30 | You can activate them like this: |
31 | |
31 | |
32 | rxvt -pe <extensionname> |
32 | rxvt -pe <extensionname> |
|
|
33 | |
|
|
34 | Or by adding them to the resource for extensions loaded by default: |
|
|
35 | |
|
|
36 | URxvt.perl-ext-common: default,automove-background,selection-autotransform |
33 | |
37 | |
34 | selection (enabled by default) |
38 | selection (enabled by default) |
35 | (More) intelligent selection. This extension tries to be more |
39 | (More) intelligent selection. This extension tries to be more |
36 | intelligent when the user extends selections (double-click and |
40 | intelligent when the user extends selections (double-click and |
37 | further clicks). Right now, it tries to select words, urls and |
41 | further clicks). Right now, it tries to select words, urls and |
… | |
… | |
71 | options at runtime. |
75 | options at runtime. |
72 | |
76 | |
73 | selection-popup (enabled by default) |
77 | selection-popup (enabled by default) |
74 | Binds a popup menu to Ctrl-Button3 that lets you convert the |
78 | Binds a popup menu to Ctrl-Button3 that lets you convert the |
75 | selection text into various other formats/action (such as uri |
79 | selection text into various other formats/action (such as uri |
76 | unescaping, perl evalution, web-browser starting etc.), depending on |
80 | unescaping, perl evaluation, web-browser starting etc.), depending |
77 | content. |
81 | on content. |
78 | |
82 | |
79 | Other extensions can extend this popup menu by pushing a code |
83 | Other extensions can extend this popup menu by pushing a code |
80 | reference onto "@{ $term-"{selection_popup_hook} }>, that is called |
84 | reference onto "@{ $term-"{selection_popup_hook} }>, that is called |
81 | whenever the popup is displayed. |
85 | whenever the popup is displayed. |
82 | |
86 | |
… | |
… | |
108 | "End" jumps to the bottom. "Escape" leaves search mode and returns |
112 | "End" jumps to the bottom. "Escape" leaves search mode and returns |
109 | to the point where search was started, while "Enter" or "Return" |
113 | to the point where search was started, while "Enter" or "Return" |
110 | stay at the current position and additionally stores the first match |
114 | stay at the current position and additionally stores the first match |
111 | in the current line into the primary selection. |
115 | in the current line into the primary selection. |
112 | |
116 | |
|
|
117 | readline (enabled by default) |
|
|
118 | A support package that tries to make editing with readline easier. |
|
|
119 | At the moment, it reacts to clicking with the left mouse button by |
|
|
120 | trying to move the text cursor to this position. It does so by |
|
|
121 | generating as many cursor-left or cursor-right keypresses as |
|
|
122 | required (the this only works for programs that correctly support |
|
|
123 | wide characters). |
|
|
124 | |
|
|
125 | To avoid too many false positives, this is only done when: |
|
|
126 | |
|
|
127 | - the mouse is on the same (multi-row-) line as the text cursor. |
|
|
128 | - the primary screen is currently being displayed. |
|
|
129 | - the text cursor is visible. |
|
|
130 | |
|
|
131 | The normal selection mechanism isn't disabled, so quick successive |
|
|
132 | clicks might interfere with selection creation in harmless ways. |
|
|
133 | |
113 | selection-autotransform |
134 | selection-autotransform |
114 | This selection allows you to do automatic transforms on a selection |
135 | This selection allows you to do automatic transforms on a selection |
115 | whenever a selection is made. |
136 | whenever a selection is made. |
116 | |
137 | |
117 | It works by specifying perl snippets (most useful is a single "s///" |
138 | It works by specifying perl snippets (most useful is a single "s///" |
… | |
… | |
142 | URxvt.selection-autotransform.0: s/^ at (.*?) line (\\d+)[,.]$/:e \\Q$1\E\\x0d:$2\\x0d/ |
163 | URxvt.selection-autotransform.0: s/^ at (.*?) line (\\d+)[,.]$/:e \\Q$1\E\\x0d:$2\\x0d/ |
143 | |
164 | |
144 | The first line tells the selection code to treat the unchanging part |
165 | The first line tells the selection code to treat the unchanging part |
145 | of every error message as a selection pattern, and the second line |
166 | of every error message as a selection pattern, and the second line |
146 | transforms the message into vi commands to load the file. |
167 | transforms the message into vi commands to load the file. |
|
|
168 | |
|
|
169 | tabbed |
|
|
170 | This transforms the terminal into a tabbar with additional |
|
|
171 | terminals, that is, it implements what is commonly refered to as |
|
|
172 | "tabbed terminal". The topmost line displays a "[NEW]" button, |
|
|
173 | which, when clicked, will add a new tab, followed by one button per |
|
|
174 | tab. |
|
|
175 | |
|
|
176 | Clicking a button will activate that tab. Pressing Shift-Left and |
|
|
177 | Shift-Right will switch to the tab left or right of the current one, |
|
|
178 | while Shift-Down creates a new tab. |
147 | |
179 | |
148 | mark-urls |
180 | mark-urls |
149 | Uses per-line display filtering ("on_line_update") to underline urls |
181 | Uses per-line display filtering ("on_line_update") to underline urls |
150 | and make them clickable. When middle-clicked, the program specified |
182 | and make them clickable. When middle-clicked, the program specified |
151 | in the resource "urlLauncher" (default "x-www-browser") will be |
183 | in the resource "urlLauncher" (default "x-www-browser") will be |
… | |
… | |
260 | be called whenever the relevant event happens. |
292 | be called whenever the relevant event happens. |
261 | |
293 | |
262 | The first argument passed to them is an extension oject as described in |
294 | The first argument passed to them is an extension oject as described in |
263 | the in the "Extension Objects" section. |
295 | the in the "Extension Objects" section. |
264 | |
296 | |
265 | All of these hooks must return a boolean value. If it is true, then the |
297 | All of these hooks must return a boolean value. If any of the called |
266 | event counts as being *consumed*, and the invocation of other hooks is |
298 | hooks returns true, then the event counts as being *consumed*, and the |
267 | skipped, and the relevant action might not be carried out by the C++ |
299 | relevant action might not be carried out by the C++ code. |
268 | code. |
|
|
269 | |
300 | |
270 | *When in doubt, return a false value (preferably "()").* |
301 | *When in doubt, return a false value (preferably "()").* |
271 | |
302 | |
272 | on_init $term |
303 | on_init $term |
273 | Called after a new terminal object has been initialized, but before |
304 | Called after a new terminal object has been initialized, but before |
274 | windows are created or the command gets run. Most methods are unsafe |
305 | windows are created or the command gets run. Most methods are unsafe |
275 | to call or deliver senseless data, as terminal size and other |
306 | to call or deliver senseless data, as terminal size and other |
276 | characteristics have not yet been determined. You can safely query |
307 | characteristics have not yet been determined. You can safely query |
277 | and change resources, though. |
308 | and change resources and options, though. For many purposes the |
|
|
309 | "on_start" hook is a better place. |
|
|
310 | |
|
|
311 | on_start $term |
|
|
312 | Called at the very end of initialisation of a new terminal, just |
|
|
313 | before trying to map (display) the toplevel and returning to the |
|
|
314 | mainloop. |
|
|
315 | |
|
|
316 | on_destroy $term |
|
|
317 | Called whenever something tries to destroy terminal, before doing |
|
|
318 | anything yet. If this hook returns true, then destruction is |
|
|
319 | skipped, but this is rarely a good idea. |
278 | |
320 | |
279 | on_reset $term |
321 | on_reset $term |
280 | Called after the screen is "reset" for any reason, such as resizing |
322 | Called after the screen is "reset" for any reason, such as resizing |
281 | or control sequences. Here is where you can react on changes to |
323 | or control sequences. Here is where you can react on changes to |
282 | size-related variables. |
324 | size-related variables. |
283 | |
|
|
284 | on_start $term |
|
|
285 | Called at the very end of initialisation of a new terminal, just |
|
|
286 | before returning to the mainloop. |
|
|
287 | |
325 | |
288 | on_child_start $term, $pid |
326 | on_child_start $term, $pid |
289 | Called just after the child process has been "fork"ed. |
327 | Called just after the child process has been "fork"ed. |
290 | |
328 | |
291 | on_child_exit $term, $status |
329 | on_child_exit $term, $status |
… | |
… | |
397 | on_focus_out $term |
435 | on_focus_out $term |
398 | Called wheneever the window loses keyboard focus, before |
436 | Called wheneever the window loses keyboard focus, before |
399 | rxvt-unicode does focus out processing. |
437 | rxvt-unicode does focus out processing. |
400 | |
438 | |
401 | on_configure_notify $term, $event |
439 | on_configure_notify $term, $event |
|
|
440 | on_property_notify $term, $event |
402 | on_key_press $term, $event, $keysym, $octets |
441 | on_key_press $term, $event, $keysym, $octets |
403 | on_key_release $term, $event, $keysym |
442 | on_key_release $term, $event, $keysym |
404 | on_button_press $term, $event |
443 | on_button_press $term, $event |
405 | on_button_release $term, $event |
444 | on_button_release $term, $event |
406 | on_motion_notify $term, $event |
445 | on_motion_notify $term, $event |
… | |
… | |
410 | terminal If the hook returns true, then the even will be ignored by |
449 | terminal If the hook returns true, then the even will be ignored by |
411 | rxvt-unicode. |
450 | rxvt-unicode. |
412 | |
451 | |
413 | The event is a hash with most values as named by Xlib (see the |
452 | The event is a hash with most values as named by Xlib (see the |
414 | XEvent manpage), with the additional members "row" and "col", which |
453 | XEvent manpage), with the additional members "row" and "col", which |
415 | are the row and column under the mouse cursor. |
454 | are the (real, not screen-based) row and column under the mouse |
|
|
455 | cursor. |
416 | |
456 | |
417 | "on_key_press" additionally receives the string rxvt-unicode would |
457 | "on_key_press" additionally receives the string rxvt-unicode would |
418 | output, if any, in locale-specific encoding. |
458 | output, if any, in locale-specific encoding. |
419 | |
459 | |
420 | subwindow. |
460 | subwindow. |
|
|
461 | |
|
|
462 | on_client_message $term, $event |
|
|
463 | on_wm_protocols $term, $event |
|
|
464 | on_wm_delete_window $term, $event |
|
|
465 | Called when various types of ClientMessage events are received (all |
|
|
466 | with format=32, WM_PROTOCOLS or WM_PROTOCOLS:WM_DELETE_WINDOW). |
421 | |
467 | |
422 | Variables in the "urxvt" Package |
468 | Variables in the "urxvt" Package |
423 | $urxvt::LIBDIR |
469 | $urxvt::LIBDIR |
424 | The rxvt-unicode library directory, where, among other things, the |
470 | The rxvt-unicode library directory, where, among other things, the |
425 | perl modules and scripts are stored. |
471 | perl modules and scripts are stored. |
… | |
… | |
432 | The basename of the installed binaries, usually "urxvt". |
478 | The basename of the installed binaries, usually "urxvt". |
433 | |
479 | |
434 | $urxvt::TERM |
480 | $urxvt::TERM |
435 | The current terminal. This variable stores the current "urxvt::term" |
481 | The current terminal. This variable stores the current "urxvt::term" |
436 | object, whenever a callback/hook is executing. |
482 | object, whenever a callback/hook is executing. |
|
|
483 | |
|
|
484 | @urxvt::TERM_INIT |
|
|
485 | All coderefs in this array will be called as methods of the next |
|
|
486 | newly created "urxvt::term" object (during the "on_init" phase). The |
|
|
487 | array gets cleared before the codereferences that were in it are |
|
|
488 | being executed, so coderefs can push themselves onto it again if |
|
|
489 | they so desire. |
|
|
490 | |
|
|
491 | This complements to the perl-eval commandline option, but gets |
|
|
492 | executed first. |
|
|
493 | |
|
|
494 | @urxvt::TERM_EXT |
|
|
495 | Works similar to @TERM_INIT, but contains perl package/class names, |
|
|
496 | which get registered as normal extensions after calling the hooks in |
|
|
497 | @TERM_INIT but before other extensions. Gets cleared just like |
|
|
498 | @TERM_INIT. |
437 | |
499 | |
438 | Functions in the "urxvt" Package |
500 | Functions in the "urxvt" Package |
439 | urxvt::fatal $errormessage |
501 | urxvt::fatal $errormessage |
440 | Fatally aborts execution with the given error message. Avoid at all |
502 | Fatally aborts execution with the given error message. Avoid at all |
441 | costs! The only time this is acceptable is when the terminal process |
503 | costs! The only time this is acceptable is when the terminal process |
… | |
… | |
715 | |
777 | |
716 | Normally its not a good idea to use this function, as programs might |
778 | Normally its not a good idea to use this function, as programs might |
717 | be confused by changes in cursor position or scrolling. Its useful |
779 | be confused by changes in cursor position or scrolling. Its useful |
718 | inside a "on_add_lines" hook, though. |
780 | inside a "on_add_lines" hook, though. |
719 | |
781 | |
|
|
782 | $term->scr_change_screen ($screen) |
|
|
783 | Switch to given screen - 0 primary, 1 secondary. |
|
|
784 | |
720 | $term->cmd_parse ($octets) |
785 | $term->cmd_parse ($octets) |
721 | Similar to "scr_add_lines", but the argument must be in the |
786 | Similar to "scr_add_lines", but the argument must be in the |
722 | locale-specific encoding of the terminal and can contain command |
787 | locale-specific encoding of the terminal and can contain command |
723 | sequences (escape codes) that will be interpreted. |
788 | sequences (escape codes) that will be interpreted. |
724 | |
789 | |
… | |
… | |
775 | $modifiermask = $term->ModNumLockMask |
840 | $modifiermask = $term->ModNumLockMask |
776 | Return the modifier masks corresponding to the "ISO Level 3 Shift" |
841 | Return the modifier masks corresponding to the "ISO Level 3 Shift" |
777 | (often AltGr), the meta key (often Alt) and the num lock key, if |
842 | (often AltGr), the meta key (often Alt) and the num lock key, if |
778 | applicable. |
843 | applicable. |
779 | |
844 | |
|
|
845 | $screen = $term->current_screen |
|
|
846 | Returns the currently displayed screen (0 primary, 1 secondary). |
|
|
847 | |
|
|
848 | $cursor_is_hidden = $term->hidden_cursor |
|
|
849 | Returns wether the cursor is currently hidden or not. |
|
|
850 | |
780 | $view_start = $term->view_start ([$newvalue]) |
851 | $view_start = $term->view_start ([$newvalue]) |
781 | Returns the row number of the topmost displayed line. Maximum value |
852 | Returns the row number of the topmost displayed line. Maximum value |
782 | is 0, which displays the normal terminal contents. Lower values |
853 | is 0, which displays the normal terminal contents. Lower values |
783 | scroll this many lines into the scrollback buffer. |
854 | scroll this many lines into the scrollback buffer. |
784 | |
855 | |
… | |
… | |
800 | line, starting at column $start_col (default 0), which is useful to |
871 | line, starting at column $start_col (default 0), which is useful to |
801 | replace only parts of a line. The font index in the rendition will |
872 | replace only parts of a line. The font index in the rendition will |
802 | automatically be updated. |
873 | automatically be updated. |
803 | |
874 | |
804 | $text is in a special encoding: tabs and wide characters that use |
875 | $text is in a special encoding: tabs and wide characters that use |
805 | more than one cell when displayed are padded with urxvt::NOCHAR |
876 | more than one cell when displayed are padded with $urxvt::NOCHAR |
806 | characters ("chr 65535"). Characters with combining characters and |
877 | characters. Characters with combining characters and other |
807 | other characters that do not fit into the normal tetx encoding will |
878 | characters that do not fit into the normal tetx encoding will be |
808 | be replaced with characters in the private use area. |
879 | replaced with characters in the private use area. |
809 | |
880 | |
810 | You have to obey this encoding when changing text. The advantage is |
881 | You have to obey this encoding when changing text. The advantage is |
811 | that "substr" and similar functions work on screen cells and not on |
882 | that "substr" and similar functions work on screen cells and not on |
812 | characters. |
883 | characters. |
813 | |
884 | |
… | |
… | |
891 | |
962 | |
892 | $term->ungrab |
963 | $term->ungrab |
893 | Calls XUngrab for the most recent grab. Is called automatically on |
964 | Calls XUngrab for the most recent grab. Is called automatically on |
894 | evaluation errors, as it is better to lose the grab in the error |
965 | evaluation errors, as it is better to lose the grab in the error |
895 | case as the session. |
966 | case as the session. |
|
|
967 | |
|
|
968 | $atom = $term->XInternAtom ($atom_name[, $only_if_exists]) |
|
|
969 | $atom_name = $term->XGetAtomName ($atom) |
|
|
970 | @atoms = $term->XListProperties ($window) |
|
|
971 | ($type,$format,$octets) = $term->XGetWindowProperty ($window, $property) |
|
|
972 | $term->XChangeWindowProperty ($window, $property, $type, $format, |
|
|
973 | $octets) |
|
|
974 | $term->XDeleteProperty ($window, $property) |
|
|
975 | $window = $term->DefaultRootWindow |
|
|
976 | $term->XReparentWindow ($window, $parent, [$x, $y]) |
|
|
977 | $term->XMapWindow ($window) |
|
|
978 | $term->XUnmapWindow ($window) |
|
|
979 | $term->XMoveResizeWindow ($window, $x, $y, $width, $height) |
|
|
980 | ($x, $y, $child_window) = $term->XTranslateCoordinates ($src, $dst, $x, |
|
|
981 | $y) |
|
|
982 | $term->XChangeInput ($window, $add_events[, $del_events]) |
|
|
983 | Various X or X-related functions. The $term object only serves as |
|
|
984 | the source of the display, otherwise those functions map |
|
|
985 | more-or-less directory onto the X functions of the same name. |
896 | |
986 | |
897 | The "urxvt::popup" Class |
987 | The "urxvt::popup" Class |
898 | $popup->add_title ($title) |
988 | $popup->add_title ($title) |
899 | Adds a non-clickable title to the popup. |
989 | Adds a non-clickable title to the popup. |
900 | |
990 | |
… | |
… | |
992 | Start watching for requested events on the given handle. |
1082 | Start watching for requested events on the given handle. |
993 | |
1083 | |
994 | $iow = $iow->stop |
1084 | $iow = $iow->stop |
995 | Stop watching for events on the given filehandle. |
1085 | Stop watching for events on the given filehandle. |
996 | |
1086 | |
|
|
1087 | The "urxvt::iw" Class |
|
|
1088 | This class implements idle watchers, that get called automatically when |
|
|
1089 | the process is idle. They should return as fast as possible, after doing |
|
|
1090 | some useful work. |
|
|
1091 | |
|
|
1092 | $iw = new urxvt::iw |
|
|
1093 | Create a new idle watcher object in stopped state. |
|
|
1094 | |
|
|
1095 | $iw = $iw->cb (sub { my ($iw) = @_; ... }) |
|
|
1096 | Set the callback to be called when the watcher triggers. |
|
|
1097 | |
|
|
1098 | $timer = $timer->start |
|
|
1099 | Start the watcher. |
|
|
1100 | |
|
|
1101 | $timer = $timer->stop |
|
|
1102 | Stop the watcher. |
|
|
1103 | |
|
|
1104 | The "urxvt::pw" Class |
|
|
1105 | This class implements process watchers. They create an event whenever a |
|
|
1106 | process exits, after which they stop automatically. |
|
|
1107 | |
|
|
1108 | my $pid = fork; |
|
|
1109 | ... |
|
|
1110 | $term->{pw} = urxvt::pw |
|
|
1111 | ->new |
|
|
1112 | ->start ($pid) |
|
|
1113 | ->cb (sub { |
|
|
1114 | my ($pw, $exit_status) = @_; |
|
|
1115 | ... |
|
|
1116 | }); |
|
|
1117 | |
|
|
1118 | $pw = new urxvt::pw |
|
|
1119 | Create a new process watcher in stopped state. |
|
|
1120 | |
|
|
1121 | $pw = $pw->cb (sub { my ($pw, $exit_status) = @_; ... }) |
|
|
1122 | Set the callback to be called when the timer triggers. |
|
|
1123 | |
|
|
1124 | $pw = $timer->start ($pid) |
|
|
1125 | Tells the wqtcher to start watching for process $pid. |
|
|
1126 | |
|
|
1127 | $pw = $pw->stop |
|
|
1128 | Stop the watcher. |
|
|
1129 | |
997 | ENVIRONMENT |
1130 | ENVIRONMENT |
998 | URXVT_PERL_VERBOSITY |
1131 | URXVT_PERL_VERBOSITY |
999 | This variable controls the verbosity level of the perl extension. Higher |
1132 | This variable controls the verbosity level of the perl extension. Higher |
1000 | numbers indicate more verbose output. |
1133 | numbers indicate more verbose output. |
1001 | |
1134 | |