1 | NAME |
1 | NAME |
2 | urxvtperl - rxvt-unicode's embedded perl interpreter |
2 | rxvtperl - rxvt-unicode's embedded perl interpreter |
3 | |
3 | |
4 | SYNOPSIS |
4 | SYNOPSIS |
5 | # create a file grab_test in $HOME: |
5 | # create a file grab_test in $HOME: |
6 | |
6 | |
7 | sub on_sel_grab { |
7 | sub on_sel_grab { |
8 | warn "you selected ", $_[0]->selection; |
8 | warn "you selected ", $_[0]->selection; |
9 | () |
9 | () |
10 | } |
10 | } |
11 | |
11 | |
12 | # start a urxvt using it: |
12 | # start a rxvt using it: |
13 | |
13 | |
14 | urxvt --perl-lib $HOME -pe grab_test |
14 | rxvt --perl-lib $HOME -pe grab_test |
15 | |
15 | |
16 | DESCRIPTION |
16 | DESCRIPTION |
17 | Every time a terminal object gets created, extension scripts specified |
17 | Every time a terminal object gets created, extension scripts specified |
18 | via the "perl" resource are loaded and associated with it. |
18 | via the "perl" resource are loaded and associated with it. |
19 | |
19 | |
20 | Scripts are compiled in a 'use strict' and 'use utf8' environment, and |
20 | Scripts are compiled in a 'use strict' and 'use utf8' environment, and |
21 | thus must be encoded as UTF-8. |
21 | thus must be encoded as UTF-8. |
22 | |
22 | |
23 | Each script will only ever be loaded once, even in urxvtd, where scripts |
23 | Each script will only ever be loaded once, even in rxvtd, where scripts |
24 | will be shared (but not enabled) for all terminals. |
24 | will be shared (but not enabled) for all terminals. |
25 | |
25 | |
26 | You can disable the embedded perl interpreter by setting both "perl-ext" |
26 | You can disable the embedded perl interpreter by setting both "perl-ext" |
27 | and "perl-ext-common" resources to the empty string. |
27 | and "perl-ext-common" resources to the empty string. |
28 | |
28 | |
29 | PREPACKAGED EXTENSIONS |
29 | PREPACKAGED EXTENSIONS |
30 | This section describes the extensions delivered with this release. You |
30 | This section describes the extensions delivered with this release. You |
31 | can find them in /usr/local/lib/urxvt/perl/. |
31 | can find them in /opt/rxvt/lib/urxvt/perl/. |
32 | |
32 | |
33 | You can activate them like this: |
33 | You can activate them like this: |
34 | |
34 | |
35 | urxvt -pe <extensionname> |
35 | rxvt -pe <extensionname> |
36 | |
36 | |
37 | Or by adding them to the resource for extensions loaded by default: |
37 | Or by adding them to the resource for extensions loaded by default: |
38 | |
38 | |
39 | URxvt.perl-ext-common: default,automove-background,selection-autotransform |
39 | URxvt.perl-ext-common: default,selection-autotransform |
40 | |
40 | |
41 | selection (enabled by default) |
41 | selection (enabled by default) |
42 | (More) intelligent selection. This extension tries to be more |
42 | (More) intelligent selection. This extension tries to be more |
43 | intelligent when the user extends selections (double-click and |
43 | intelligent when the user extends selections (double-click and |
44 | further clicks). Right now, it tries to select words, urls and |
44 | further clicks). Right now, it tries to select words, urls and |
… | |
… | |
86 | |
86 | |
87 | Other extensions can extend this popup menu by pushing a code |
87 | Other extensions can extend this popup menu by pushing a code |
88 | reference onto "@{ $term-"{option_popup_hook} }>, which gets called |
88 | reference onto "@{ $term-"{option_popup_hook} }>, which gets called |
89 | whenever the popup is being displayed. |
89 | whenever the popup is being displayed. |
90 | |
90 | |
91 | It's sole argument is the popup menu, which can be modified. It |
91 | Its sole argument is the popup menu, which can be modified. It |
92 | should either return nothing or a string, the initial boolean value |
92 | should either return nothing or a string, the initial boolean value |
93 | and a code reference. The string will be used as button text and the |
93 | and a code reference. The string will be used as button text and the |
94 | code reference will be called when the toggle changes, with the new |
94 | code reference will be called when the toggle changes, with the new |
95 | boolean value as first argument. |
95 | boolean value as first argument. |
96 | |
96 | |
… | |
… | |
109 | |
109 | |
110 | Other extensions can extend this popup menu by pushing a code |
110 | Other extensions can extend this popup menu by pushing a code |
111 | reference onto "@{ $term-"{selection_popup_hook} }>, which gets |
111 | reference onto "@{ $term-"{selection_popup_hook} }>, which gets |
112 | called whenever the popup is being displayed. |
112 | called whenever the popup is being displayed. |
113 | |
113 | |
114 | It's sole argument is the popup menu, which can be modified. The |
114 | Its sole argument is the popup menu, which can be modified. The |
115 | selection is in $_, which can be used to decide whether to add |
115 | selection is in $_, which can be used to decide whether to add |
116 | something or not. It should either return nothing or a string and a |
116 | something or not. It should either return nothing or a string and a |
117 | code reference. The string will be used as button text and the code |
117 | code reference. The string will be used as button text and the code |
118 | reference will be called when the button gets activated and should |
118 | reference will be called when the button gets activated and should |
119 | transform $_. |
119 | transform $_. |
… | |
… | |
121 | The following will add an entry "a to b" that transforms all "a"s in |
121 | The following will add an entry "a to b" that transforms all "a"s in |
122 | the selection to "b"s, but only if the selection currently contains |
122 | the selection to "b"s, but only if the selection currently contains |
123 | any "a"s: |
123 | any "a"s: |
124 | |
124 | |
125 | push @{ $self->{term}{selection_popup_hook} }, sub { |
125 | push @{ $self->{term}{selection_popup_hook} }, sub { |
126 | /a/ ? ("a to be" => sub { s/a/b/g } |
126 | /a/ ? ("a to b" => sub { s/a/b/g } |
127 | : () |
127 | : () |
128 | }; |
128 | }; |
129 | |
129 | |
130 | searchable-scrollback<hotkey> (enabled by default) |
130 | searchable-scrollback<hotkey> (enabled by default) |
131 | Adds regex search functionality to the scrollback buffer, triggered |
131 | Adds regex search functionality to the scrollback buffer, triggered |
… | |
… | |
220 | URxvt.tabbed.tabbar-fg: <colour-index, default 3> |
220 | URxvt.tabbed.tabbar-fg: <colour-index, default 3> |
221 | URxvt.tabbed.tabbar-bg: <colour-index, default 0> |
221 | URxvt.tabbed.tabbar-bg: <colour-index, default 0> |
222 | URxvt.tabbed.tab-fg: <colour-index, default 0> |
222 | URxvt.tabbed.tab-fg: <colour-index, default 0> |
223 | URxvt.tabbed.tab-bg: <colour-index, default 1> |
223 | URxvt.tabbed.tab-bg: <colour-index, default 1> |
224 | |
224 | |
225 | See *COLOR AND GRAPHICS* in the urxvt(1) manpage for valid indices. |
225 | See *COLOR AND GRAPHICS* in the rxvt(1) manpage for valid indices. |
226 | |
226 | |
227 | matcher |
227 | matcher |
228 | Uses per-line display filtering ("on_line_update") to underline text |
228 | Uses per-line display filtering ("on_line_update") to underline text |
229 | matching a certain pattern and make it clickable. When clicked with |
229 | matching a certain pattern and make it clickable. When clicked with |
230 | the mouse button specified in the "matcher.button" resource (default |
230 | the mouse button specified in the "matcher.button" resource (default |
… | |
… | |
256 | |
256 | |
257 | xim-onthespot |
257 | xim-onthespot |
258 | This (experimental) perl extension implements OnTheSpot editing. It |
258 | This (experimental) perl extension implements OnTheSpot editing. It |
259 | does not work perfectly, and some input methods don't seem to work |
259 | does not work perfectly, and some input methods don't seem to work |
260 | well with OnTheSpot editing in general, but it seems to work at |
260 | well with OnTheSpot editing in general, but it seems to work at |
261 | leats for SCIM and kinput2. |
261 | least for SCIM and kinput2. |
262 | |
262 | |
263 | You enable it by specifying this extension and a preedit style of |
263 | You enable it by specifying this extension and a preedit style of |
264 | "OnTheSpot", i.e.: |
264 | "OnTheSpot", i.e.: |
265 | |
265 | |
266 | urxvt -pt OnTheSpot -pe xim-onthespot |
266 | rxvt -pt OnTheSpot -pe xim-onthespot |
267 | |
267 | |
268 | kuake<hotkey> |
268 | kuake<hotkey> |
269 | A very primitive quake-console-like extension. It was inspired by a |
269 | A very primitive quake-console-like extension. It was inspired by a |
270 | description of how the programs "kuake" and "yakuake" work: Whenever |
270 | description of how the programs "kuake" and "yakuake" work: Whenever |
271 | the user presses a global accelerator key (by default "F10"), the |
271 | the user presses a global accelerator key (by default "F10"), the |
272 | terminal will show or hide itself. Another press of the accelerator |
272 | terminal will show or hide itself. Another press of the accelerator |
273 | key will hide or show it again. |
273 | key will hide or show it again. |
274 | |
274 | |
275 | Initially, the window will not be shown when using this extension. |
275 | Initially, the window will not be shown when using this extension. |
276 | |
276 | |
277 | This is useful if you need a single terminal thats not using any |
277 | This is useful if you need a single terminal that is not using any |
278 | desktop space most of the time but is quickly available at the press |
278 | desktop space most of the time but is quickly available at the press |
279 | of a key. |
279 | of a key. |
280 | |
280 | |
281 | The accelerator key is grabbed regardless of any modifiers, so this |
281 | The accelerator key is grabbed regardless of any modifiers, so this |
282 | extension will actually grab a physical key just for this function. |
282 | extension will actually grab a physical key just for this function. |
283 | |
283 | |
284 | If you want a quake-like animation, tell your window manager to do |
284 | If you want a quake-like animation, tell your window manager to do |
285 | so (fvwm can do it). |
285 | so (fvwm can do it). |
286 | |
|
|
287 | automove-background |
|
|
288 | This is basically a very small extension that dynamically changes |
|
|
289 | the background pixmap offset to the window position, in effect |
|
|
290 | creating the same effect as pseudo transparency with a custom |
|
|
291 | pixmap. No scaling is supported in this mode. Example: |
|
|
292 | |
|
|
293 | urxvt -pixmap background.xpm -pe automove-background |
|
|
294 | |
|
|
295 | <http://wiki.archlinux.org/index.php/Perl_Background_Rotation/Extens |
|
|
296 | ions> shows how this extension can be used to implement an |
|
|
297 | automatically blurred transparent background. |
|
|
298 | |
286 | |
299 | block-graphics-to-ascii |
287 | block-graphics-to-ascii |
300 | A not very useful example of filtering all text output to the |
288 | A not very useful example of filtering all text output to the |
301 | terminal by replacing all line-drawing characters (U+2500 .. U+259F) |
289 | terminal by replacing all line-drawing characters (U+2500 .. U+259F) |
302 | by a similar-looking ascii character. |
290 | by a similar-looking ascii character. |
… | |
… | |
304 | digital-clock |
292 | digital-clock |
305 | Displays a digital clock using the built-in overlay. |
293 | Displays a digital clock using the built-in overlay. |
306 | |
294 | |
307 | remote-clipboard |
295 | remote-clipboard |
308 | Somewhat of a misnomer, this extension adds two menu entries to the |
296 | Somewhat of a misnomer, this extension adds two menu entries to the |
309 | selection popup that allows one ti run external commands to store |
297 | selection popup that allows one to run external commands to store |
310 | the selection somewhere and fetch it again. |
298 | the selection somewhere and fetch it again. |
311 | |
299 | |
312 | We use it to implement a "distributed selection mechanism", which |
300 | We use it to implement a "distributed selection mechanism", which |
313 | just means that one command uploads the file to a remote server, and |
301 | just means that one command uploads the file to a remote server, and |
314 | another reads it. |
302 | another reads it. |
… | |
… | |
557 | Called just after the screen gets redrawn. See "on_refresh_begin". |
545 | Called just after the screen gets redrawn. See "on_refresh_begin". |
558 | |
546 | |
559 | on_user_command $term, $string |
547 | on_user_command $term, $string |
560 | Called whenever a user-configured event is being activated (e.g. via |
548 | Called whenever a user-configured event is being activated (e.g. via |
561 | a "perl:string" action bound to a key, see description of the keysym |
549 | a "perl:string" action bound to a key, see description of the keysym |
562 | resource in the urxvt(1) manpage). |
550 | resource in the rxvt(1) manpage). |
563 | |
551 | |
564 | The event is simply the action string. This interface is assumed to |
552 | The event is simply the action string. This interface is assumed to |
565 | change slightly in the future. |
553 | change slightly in the future. |
566 | |
554 | |
567 | on_resize_all_windows $tern, $new_width, $new_height |
555 | on_resize_all_windows $tern, $new_width, $new_height |
… | |
… | |
754 | "start" hooks will be called before this call returns, and are free |
742 | "start" hooks will be called before this call returns, and are free |
755 | to refer to global data (which is race free). |
743 | to refer to global data (which is race free). |
756 | |
744 | |
757 | $term->destroy |
745 | $term->destroy |
758 | Destroy the terminal object (close the window, free resources etc.). |
746 | Destroy the terminal object (close the window, free resources etc.). |
759 | Please note that urxvt will not exit as long as any event watchers |
747 | Please note that rxvt will not exit as long as any event watchers |
760 | (timers, io watchers) are still active. |
748 | (timers, io watchers) are still active. |
761 | |
749 | |
762 | $term->exec_async ($cmd[, @args]) |
750 | $term->exec_async ($cmd[, @args]) |
763 | Works like the combination of the "fork"/"exec" builtins, which |
751 | Works like the combination of the "fork"/"exec" builtins, which |
764 | executes ("starts") programs in the background. This function takes |
752 | executes ("starts") programs in the background. This function takes |
… | |
… | |
829 | there is only one resource database per display, and later |
817 | there is only one resource database per display, and later |
830 | invocations might return the wrong resources. |
818 | invocations might return the wrong resources. |
831 | |
819 | |
832 | $success = $term->parse_keysym ($keysym_spec, $command_string) |
820 | $success = $term->parse_keysym ($keysym_spec, $command_string) |
833 | Adds a keymap translation exactly as specified via a resource. See |
821 | Adds a keymap translation exactly as specified via a resource. See |
834 | the "keysym" resource in the urxvt(1) manpage. |
822 | the "keysym" resource in the rxvt(1) manpage. |
835 | |
823 | |
836 | $rend = $term->rstyle ([$new_rstyle]) |
824 | $rend = $term->rstyle ([$new_rstyle]) |
837 | Return and optionally change the current rendition. Text that is |
825 | Return and optionally change the current rendition. Text that is |
838 | output by the terminal application will use this style. |
826 | output by the terminal application will use this style. |
839 | |
827 | |
… | |
… | |
1192 | ->new |
1180 | ->new |
1193 | ->interval (1) |
1181 | ->interval (1) |
1194 | ->cb (sub { |
1182 | ->cb (sub { |
1195 | $term->{overlay}->set (0, 0, |
1183 | $term->{overlay}->set (0, 0, |
1196 | sprintf "%2d:%02d:%02d", (localtime urxvt::NOW)[2,1,0]); |
1184 | sprintf "%2d:%02d:%02d", (localtime urxvt::NOW)[2,1,0]); |
1197 | }); |
1185 | }); |
1198 | |
1186 | |
1199 | $timer = new urxvt::timer |
1187 | $timer = new urxvt::timer |
1200 | Create a new timer object in started state. It is scheduled to fire |
1188 | Create a new timer object in started state. It is scheduled to fire |
1201 | immediately. |
1189 | immediately. |
1202 | |
1190 | |
… | |
… | |
1231 | |
1219 | |
1232 | $term->{socket} = ... |
1220 | $term->{socket} = ... |
1233 | $term->{iow} = urxvt::iow |
1221 | $term->{iow} = urxvt::iow |
1234 | ->new |
1222 | ->new |
1235 | ->fd (fileno $term->{socket}) |
1223 | ->fd (fileno $term->{socket}) |
1236 | ->events (urxvt::EVENT_READ) |
1224 | ->events (urxvt::EV_READ) |
1237 | ->start |
1225 | ->start |
1238 | ->cb (sub { |
1226 | ->cb (sub { |
1239 | my ($iow, $revents) = @_; |
1227 | my ($iow, $revents) = @_; |
1240 | # $revents must be 1 here, no need to check |
1228 | # $revents must be 1 here, no need to check |
1241 | sysread $term->{socket}, my $buf, 8192 |
1229 | sysread $term->{socket}, my $buf, 8192 |
… | |
… | |
1252 | $iow = $iow->fd ($fd) |
1240 | $iow = $iow->fd ($fd) |
1253 | Set the file descriptor (not handle) to watch. |
1241 | Set the file descriptor (not handle) to watch. |
1254 | |
1242 | |
1255 | $iow = $iow->events ($eventmask) |
1243 | $iow = $iow->events ($eventmask) |
1256 | Set the event mask to watch. The only allowed values are |
1244 | Set the event mask to watch. The only allowed values are |
1257 | "urxvt::EVENT_READ" and "urxvt::EVENT_WRITE", which might be ORed |
1245 | "urxvt::EV_READ" and "urxvt::EV_WRITE", which might be ORed |
1258 | together, or "urxvt::EVENT_NONE". |
1246 | together, or "urxvt::EV_NONE". |
1259 | |
1247 | |
1260 | $iow = $iow->start |
1248 | $iow = $iow->start |
1261 | Start watching for requested events on the given handle. |
1249 | Start watching for requested events on the given handle. |
1262 | |
1250 | |
1263 | $iow = $iow->stop |
1251 | $iow = $iow->stop |
… | |
… | |
1290 | ->new |
1278 | ->new |
1291 | ->start ($pid) |
1279 | ->start ($pid) |
1292 | ->cb (sub { |
1280 | ->cb (sub { |
1293 | my ($pw, $exit_status) = @_; |
1281 | my ($pw, $exit_status) = @_; |
1294 | ... |
1282 | ... |
1295 | }); |
1283 | }); |
1296 | |
1284 | |
1297 | $pw = new urxvt::pw |
1285 | $pw = new urxvt::pw |
1298 | Create a new process watcher in stopped state. |
1286 | Create a new process watcher in stopped state. |
1299 | |
1287 | |
1300 | $pw = $pw->cb (sub { my ($pw, $exit_status) = @_; ... }) |
1288 | $pw = $pw->cb (sub { my ($pw, $exit_status) = @_; ... }) |