ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/doc/rxvtperl.3.txt
(Generate patch)

Comparing rxvt-unicode/doc/rxvtperl.3.txt (file contents):
Revision 1.35 by root, Sun Jan 22 20:39:56 2006 UTC vs.
Revision 1.43 by root, Mon Jul 17 19:20:29 2006 UTC

58 be used for the match. For example, the followign adds a regex that 58 be used for the match. For example, the followign adds a regex that
59 matches everything between two vertical bars: 59 matches everything between two vertical bars:
60 60
61 URxvt.selection.pattern-0: \\|([^|]+)\\| 61 URxvt.selection.pattern-0: \\|([^|]+)\\|
62 62
63 Another example: Programs I use often output "absolute path: " at
64 the beginning of a line when they process multiple files. The
65 following pattern matches the filename (note, there is a single
66 space at the very end):
67
68 URxvt.selection.pattern-0: ^(/[^:]+):\
69
63 You can look at the source of the selection extension to see more 70 You can look at the source of the selection extension to see more
64 interesting uses, such as parsing a line from beginning to end. 71 interesting uses, such as parsing a line from beginning to end.
65 72
66 This extension also offers following bindable keyboard commands: 73 This extension also offers following bindable keyboard commands:
67 74
71 URxvt.keysym.C-M-r: perl:selection:rot13 78 URxvt.keysym.C-M-r: perl:selection:rot13
72 79
73 option-popup (enabled by default) 80 option-popup (enabled by default)
74 Binds a popup menu to Ctrl-Button2 that lets you toggle (some) 81 Binds a popup menu to Ctrl-Button2 that lets you toggle (some)
75 options at runtime. 82 options at runtime.
83
84 Other extensions can extend this popup menu by pushing a code
85 reference onto "@{ $term-"{option_popup_hook} }>, which gets called
86 whenever the popup is being displayed.
87
88 It's sole argument is the popup menu, which can be modified. It
89 should either return nothing or a string, the initial boolean value
90 and a code reference. The string will be used as button text and the
91 code reference will be called when the toggle changes, with the new
92 boolean value as first argument.
93
94 The following will add an entry "myoption" that changes
95 "$self-"{myoption}>:
96
97 push @{ $self->{term}{option_popup_hook} }, sub {
98 ("my option" => $myoption, sub { $self->{myoption} = $_[0] })
99 };
76 100
77 selection-popup (enabled by default) 101 selection-popup (enabled by default)
78 Binds a popup menu to Ctrl-Button3 that lets you convert the 102 Binds a popup menu to Ctrl-Button3 that lets you convert the
79 selection text into various other formats/action (such as uri 103 selection text into various other formats/action (such as uri
80 unescaping, perl evaluation, web-browser starting etc.), depending 104 unescaping, perl evaluation, web-browser starting etc.), depending
81 on content. 105 on content.
82 106
83 Other extensions can extend this popup menu by pushing a code 107 Other extensions can extend this popup menu by pushing a code
84 reference onto "@{ $term-"{selection_popup_hook} }>, that is called 108 reference onto "@{ $term-"{selection_popup_hook} }>, which gets
85 whenever the popup is displayed. 109 called whenever the popup is being displayed.
86 110
87 It's sole argument is the popup menu, which can be modified. The 111 It's sole argument is the popup menu, which can be modified. The
88 selection is in $_, which can be used to decide wether to add 112 selection is in $_, which can be used to decide wether to add
89 something or not. It should either return nothing or a string and a 113 something or not. It should either return nothing or a string and a
90 code reference. The string will be used as button text and the code 114 code reference. The string will be used as button text and the code
112 "End" jumps to the bottom. "Escape" leaves search mode and returns 136 "End" jumps to the bottom. "Escape" leaves search mode and returns
113 to the point where search was started, while "Enter" or "Return" 137 to the point where search was started, while "Enter" or "Return"
114 stay at the current position and additionally stores the first match 138 stay at the current position and additionally stores the first match
115 in the current line into the primary selection. 139 in the current line into the primary selection.
116 140
141 The regex defaults to "(?i)", resulting in a case-insensitive
142 search. To get a case-sensitive search you can delete this prefix
143 using "BackSpace" or simply use an uppercase character which removes
144 the "(?i)" prefix.
145
146 See perlre for more info about perl regular expression syntax.
147
117 readline (enabled by default) 148 readline (enabled by default)
118 A support package that tries to make editing with readline easier. 149 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 150 At the moment, it reacts to clicking shift-left mouse button by
120 trying to move the text cursor to this position. It does so by 151 trying to move the text cursor to this position. It does so by
121 generating as many cursor-left or cursor-right keypresses as 152 generating as many cursor-left or cursor-right keypresses as
122 required (the this only works for programs that correctly support 153 required (the this only works for programs that correctly support
123 wide characters). 154 wide characters).
124 155
176 207
177 Clicking a button will activate that tab. Pressing Shift-Left and 208 Clicking a button will activate that tab. Pressing Shift-Left and
178 Shift-Right will switch to the tab left or right of the current one, 209 Shift-Right will switch to the tab left or right of the current one,
179 while Shift-Down creates a new tab. 210 while Shift-Down creates a new tab.
180 211
212 The tabbar itself can be configured similarly to a normal terminal,
213 but with a resource class of "URxvt.tabbed". In addition, it
214 supports the following four resources (shown with defaults):
215
216 URxvt.tabbed.tabbar-fg: <colour-index, default 3>
217 URxvt.tabbed.tabbar-bg: <colour-index, default 0>
218 URxvt.tabbed.tab-fg: <colour-index, default 0>
219 URxvt.tabbed.tab-bg: <colour-index, default 1>
220
221 See *COLOR AND GRAPHICS* in the rxvt(1) manpage for valid indices.
222
181 mark-urls 223 mark-urls
182 Uses per-line display filtering ("on_line_update") to underline urls 224 Uses per-line display filtering ("on_line_update") to underline urls
183 and make them clickable. When middle-clicked, the program specified 225 and make them clickable. When middle-clicked, the program specified
184 in the resource "urlLauncher" (default "x-www-browser") will be 226 in the resource "urlLauncher" (default "x-www-browser") will be
185 started with the URL as first argument. 227 started with the URL as first argument.
186 228
229 xim-onthespot
230 This (experimental) perl extension implements OnTheSpot editing. It
231 does not work perfectly, and some input methods don't seem to work
232 well with OnTheSpot editing in general, but it seems to work at
233 leats for SCIM and kinput2.
234
235 You enable it by specifying this extension and a preedit style of
236 "OnTheSpot", i.e.:
237
238 rxvt -pt OnTheSpot -pe xim-onthespot
239
240 kuake<hotkey>
241 A very primitive quake-console-like extension. It was inspired by a
242 description of how the programs "kuake" and "yakuake" work: Whenever
243 the user presses a global accelerator key (by default "F10"), the
244 terminal will show or hide itself. Another press of the accelerator
245 key will hide or show it again.
246
247 Initially, the window will not be shown when using this extension.
248
249 This is useful if you need a single terminal thats not using any
250 desktop space most of the time but is quickly available at the press
251 of a key.
252
253 The accelerator key is grabbed regardless of any modifers, so this
254 extension will actually grab a physical key just for this function.
255
256 If you want a quake-like animation, tell your window manager to do
257 so (fvwm can do it).
258
187 automove-background 259 automove-background
188 This is basically a one-line extension that dynamically changes the 260 This is basically a very small extension that dynamically changes
189 background pixmap offset to the window position, in effect creating 261 the background pixmap offset to the window position, in effect
190 the same effect as pseudo transparency with a custom pixmap. No 262 creating the same effect as pseudo transparency with a custom
191 scaling is supported in this mode. Exmaple: 263 pixmap. No scaling is supported in this mode. Exmaple:
192 264
193 rxvt -pixmap background.xpm -pe automove-background 265 rxvt -pixmap background.xpm -pe automove-background
194 266
195 block-graphics-to-ascii 267 block-graphics-to-ascii
196 A not very useful example of filtering all text output to the 268 A not very useful example of filtering all text output to the
197 terminal, by replacing all line-drawing characters (U+2500 .. 269 terminal by replacing all line-drawing characters (U+2500 .. U+259F)
198 U+259F) by a similar-looking ascii character. 270 by a similar-looking ascii character.
199 271
200 digital-clock 272 digital-clock
201 Displays a digital clock using the built-in overlay. 273 Displays a digital clock using the built-in overlay.
202 274
203 example-refresh-hooks 275 remote-clipboard
204 Displays a very simple digital clock in the upper right corner of 276 Somewhat of a misnomer, this extension adds two menu entries to the
205 the window. Illustrates overwriting the refresh callbacks to create 277 selection popup that allows one ti run external commands to store
206 your own overlays or changes. 278 the selection somewhere and fetch it again.
279
280 We use it to implement a "distributed selection mechanism", which
281 just means that one command uploads the file to a remote server, and
282 another reads it.
283
284 The commands can be set using the "URxvt.remote-selection.store" and
285 "URxvt.remote-selection.fetch" resources. The first should read the
286 selection to store from STDIN (always in UTF-8), the second should
287 provide the selection data on STDOUT (also in UTF-8).
288
289 The defaults (which are likely useless to you) use rsh and cat:
290
291 URxvt.remote-selection.store: rsh ruth 'cat >/tmp/distributed-selection'
292 URxvt.remote-selection.fetch: rsh ruth 'cat /tmp/distributed-selection'
207 293
208 selection-pastebin 294 selection-pastebin
209 This is a little rarely useful extension that Uploads the selection 295 This is a little rarely useful extension that Uploads the selection
210 as textfile to a remote site (or does other things). (The 296 as textfile to a remote site (or does other things). (The
211 implementation is not currently secure for use in a multiuser 297 implementation is not currently secure for use in a multiuser
230 After a successful upload the selection will be replaced by the text 316 After a successful upload the selection will be replaced by the text
231 given in the "selection-pastebin-url" resource (again, the % is the 317 given in the "selection-pastebin-url" resource (again, the % is the
232 placeholder for the filename): 318 placeholder for the filename):
233 319
234 URxvt.selection-pastebin.url: http://www.ta-sa.org/files/txt/% 320 URxvt.selection-pastebin.url: http://www.ta-sa.org/files/txt/%
321
322 example-refresh-hooks
323 Displays a very simple digital clock in the upper right corner of
324 the window. Illustrates overwriting the refresh callbacks to create
325 your own overlays or changes.
235 326
236API DOCUMENTATION 327API DOCUMENTATION
237 General API Considerations 328 General API Considerations
238 All objects (such as terminals, time watchers etc.) are typical 329 All objects (such as terminals, time watchers etc.) are typical
239 reference-to-hash objects. The hash can be used to store anything you 330 reference-to-hash objects. The hash can be used to store anything you
262 $octets 353 $octets
263 Either binary data or - more common - a text string encoded in a 354 Either binary data or - more common - a text string encoded in a
264 locale-specific way. 355 locale-specific way.
265 356
266 Extension Objects 357 Extension Objects
267 Very perl extension is a perl class. A separate perl object is created 358 Every perl extension is a perl class. A separate perl object is created
268 for each terminal and each extension and passed as the first parameter 359 for each terminal and each extension and passed as the first parameter
269 to hooks. So extensions can use their $self object without having to 360 to hooks. So extensions can use their $self object without having to
270 think about other extensions, with the exception of methods and members 361 think about other extensions, with the exception of methods and members
271 that begin with an underscore character "_": these are reserved for 362 that begin with an underscore character "_": these are reserved for
272 internal use. 363 internal use.
313 Called at the very end of initialisation of a new terminal, just 404 Called at the very end of initialisation of a new terminal, just
314 before trying to map (display) the toplevel and returning to the 405 before trying to map (display) the toplevel and returning to the
315 mainloop. 406 mainloop.
316 407
317 on_destroy $term 408 on_destroy $term
318 Called whenever something tries to destroy terminal, before doing 409 Called whenever something tries to destroy terminal, when the
319 anything yet. If this hook returns true, then destruction is 410 terminal is still fully functional (not for long, though).
320 skipped, but this is rarely a good idea.
321 411
322 on_reset $term 412 on_reset $term
323 Called after the screen is "reset" for any reason, such as resizing 413 Called after the screen is "reset" for any reason, such as resizing
324 or control sequences. Here is where you can react on changes to 414 or control sequences. Here is where you can react on changes to
325 size-related variables. 415 size-related variables.
371 461
372 It is called before lines are scrolled out (so rows 0 .. min ($lines 462 It is called before lines are scrolled out (so rows 0 .. min ($lines
373 - 1, $nrow - 1) represent the lines to be scrolled out). $saved is 463 - 1, $nrow - 1) represent the lines to be scrolled out). $saved is
374 the total number of lines that will be in the scrollback buffer. 464 the total number of lines that will be in the scrollback buffer.
375 465
466 on_osc_seq $term, $op, $args
467 Called on every OSC sequence and can be used to suppress it or
468 modify its behaviour. The default should be to return an empty list.
469 A true value suppresses execution of the request completely. Make
470 sure you don't get confused by recursive invocations when you output
471 an osc sequence within this callback.
472
473 "on_osc_seq_perl" should be used for new behaviour.
474
376 on_osc_seq $term, $string 475 on_osc_seq_perl $term, $string
377 Called whenever the ESC ] 777 ; string ST command sequence (OSC = 476 Called whenever the ESC ] 777 ; string ST command sequence (OSC =
378 operating system command) is processed. Cursor position and other 477 operating system command) is processed. Cursor position and other
379 state information is up-to-date when this happens. For 478 state information is up-to-date when this happens. For
380 interoperability, the string should start with the extension name 479 interoperability, the string should start with the extension name
381 and a colon, to distinguish it from commands for other extensions, 480 and a colon, to distinguish it from commands for other extensions,
417 display code is run after this hook, and takes precedence. 516 display code is run after this hook, and takes precedence.
418 517
419 on_refresh_end $term 518 on_refresh_end $term
420 Called just after the screen gets redrawn. See "on_refresh_begin". 519 Called just after the screen gets redrawn. See "on_refresh_begin".
421 520
422 on_keyboard_command $term, $string 521 on_user_command $term, $string
423 Called whenever the user presses a key combination that has a 522 Called whenever the a user-configured event is being activated (e.g.
424 "perl:string" action bound to it (see description of the keysym 523 via a "perl:string" action bound to a key, see description of the
425 resource in the rxvt(1) manpage). 524 keysym resource in the rxvt(1) manpage).
525
526 The event is simply the action string. This interface is assumed to
527 change slightly in the future.
528
529 on_resize_all_windows $tern, $new_width, $new_height
530 Called just after the new window size has been calculcated, but
531 before windows are actually being resized or hints are being set. If
532 this hook returns TRUE, setting of the window hints is being
533 skipped.
426 534
427 on_x_event $term, $event 535 on_x_event $term, $event
428 Called on every X event received on the vt window (and possibly 536 Called on every X event received on the vt window (and possibly
429 other windows). Should only be used as a last resort. Most event 537 other windows). Should only be used as a last resort. Most event
430 structure members are not passed. 538 structure members are not passed.
539
540 on_root_event $term, $event
541 Like "on_x_event", but is called for events on the root window.
431 542
432 on_focus_in $term 543 on_focus_in $term
433 Called whenever the window gets the keyboard focus, before 544 Called whenever the window gets the keyboard focus, before
434 rxvt-unicode does focus in processing. 545 rxvt-unicode does focus in processing.
435 546
511 622
512 Using this function has the advantage that its output ends up in the 623 Using this function has the advantage that its output ends up in the
513 correct place, e.g. on stderr of the connecting urxvtc client. 624 correct place, e.g. on stderr of the connecting urxvtc client.
514 625
515 Messages have a size limit of 1023 bytes currently. 626 Messages have a size limit of 1023 bytes currently.
627
628 @terms = urxvt::termlist
629 Returns all urxvt::term objects that exist in this process,
630 regardless of wether they are started, being destroyed etc., so be
631 careful. Only term objects that have perl extensions attached will
632 be returned (because there is no urxvt::term objet associated with
633 others).
516 634
517 $time = urxvt::NOW 635 $time = urxvt::NOW
518 Returns the "current time" (as per the event loop). 636 Returns the "current time" (as per the event loop).
519 637
520 urxvt::CurrentTime 638 urxvt::CurrentTime
564 $background = urxvt::GET_BASEBG $rend 682 $background = urxvt::GET_BASEBG $rend
565 Return the foreground/background colour index, respectively. 683 Return the foreground/background colour index, respectively.
566 684
567 $rend = urxvt::SET_FGCOLOR $rend, $new_colour 685 $rend = urxvt::SET_FGCOLOR $rend, $new_colour
568 $rend = urxvt::SET_BGCOLOR $rend, $new_colour 686 $rend = urxvt::SET_BGCOLOR $rend, $new_colour
687 $rend = urxvt::SET_COLOR $rend, $new_fg, $new_bg
569 Replace the foreground/background colour in the rendition mask with 688 Replace the foreground/background colour in the rendition mask with
570 the specified one. 689 the specified one.
571 690
572 $value = urxvt::GET_CUSTOM $rend 691 $value = urxvt::GET_CUSTOM $rend
573 Return the "custom" value: Every rendition has 5 bits for use by 692 Return the "custom" value: Every rendition has 5 bits for use by
592 %ENV-like hash which defines the environment of the new terminal. 711 %ENV-like hash which defines the environment of the new terminal.
593 712
594 Croaks (and probably outputs an error message) if the new instance 713 Croaks (and probably outputs an error message) if the new instance
595 couldn't be created. Returns "undef" if the new instance didn't 714 couldn't be created. Returns "undef" if the new instance didn't
596 initialise perl, and the terminal object otherwise. The "init" and 715 initialise perl, and the terminal object otherwise. The "init" and
597 "start" hooks will be called during this call. 716 "start" hooks will be called before this call returns, and are free
717 to refer to global data (which is race free).
598 718
599 $term->destroy 719 $term->destroy
600 Destroy the terminal object (close the window, free resources etc.). 720 Destroy the terminal object (close the window, free resources etc.).
601 Please note that rxvt will not exit as long as any event watchers 721 Please note that rxvt will not exit as long as any event watchers
602 (timers, io watchers) are still active. 722 (timers, io watchers) are still active.
814 Adds the specified events to the vt event mask. Useful e.g. when you 934 Adds the specified events to the vt event mask. Useful e.g. when you
815 want to receive pointer events all the times: 935 want to receive pointer events all the times:
816 936
817 $term->vt_emask_add (urxvt::PointerMotionMask); 937 $term->vt_emask_add (urxvt::PointerMotionMask);
818 938
939 $term->focus_in
940 $term->focus_out
941 $term->key_press ($state, $keycode[, $time])
942 $term->key_release ($state, $keycode[, $time])
943 Deliver various fake events to to terminal.
944
819 $window_width = $term->width 945 $window_width = $term->width
820 $window_height = $term->height 946 $window_height = $term->height
821 $font_width = $term->fwidth 947 $font_width = $term->fwidth
822 $font_height = $term->fheight 948 $font_height = $term->fheight
823 $font_ascent = $term->fbase 949 $font_ascent = $term->fbase
838 964
839 $env = $term->env 965 $env = $term->env
840 Returns a copy of the environment in effect for the terminal as a 966 Returns a copy of the environment in effect for the terminal as a
841 hashref similar to "\%ENV". 967 hashref similar to "\%ENV".
842 968
969 @envv = $term->envv
970 Returns the environment as array of strings of the form "VAR=VALUE".
971
972 @argv = $term->argv
973 Return the argument vector as this terminal, similar to @ARGV, but
974 includes the program name as first element.
975
843 $modifiermask = $term->ModLevel3Mask 976 $modifiermask = $term->ModLevel3Mask
844 $modifiermask = $term->ModMetaMask 977 $modifiermask = $term->ModMetaMask
845 $modifiermask = $term->ModNumLockMask 978 $modifiermask = $term->ModNumLockMask
846 Return the modifier masks corresponding to the "ISO Level 3 Shift" 979 Return the modifier masks corresponding to the "ISO Level 3 Shift"
847 (often AltGr), the meta key (often Alt) and the num lock key, if 980 (often AltGr), the meta key (often Alt) and the num lock key, if
946 1079
947 $string = $term->special_decode $text 1080 $string = $term->special_decode $text
948 Converts rxvt-unicodes text reprsentation into a perl string. See 1081 Converts rxvt-unicodes text reprsentation into a perl string. See
949 "$term->ROW_t" for details. 1082 "$term->ROW_t" for details.
950 1083
951 $success = $term->grab_button ($button, $modifiermask) 1084 $success = $term->grab_button ($button, $modifiermask[, $window =
1085 $term->vt])
1086 $term->ungrab_button ($button, $modifiermask[, $window = $term->vt])
952 Registers a synchronous button grab. See the XGrabButton manpage. 1087 Register/unregister a synchronous button grab. See the XGrabButton
1088 manpage.
953 1089
954 $success = $term->grab ($eventtime[, $sync]) 1090 $success = $term->grab ($eventtime[, $sync])
955 Calls XGrabPointer and XGrabKeyboard in asynchronous (default) or 1091 Calls XGrabPointer and XGrabKeyboard in asynchronous (default) or
956 synchronous ($sync is true). Also remembers the grab timestampe. 1092 synchronous ($sync is true). Also remembers the grab timestampe.
957 1093
999 1135
1000 $popup->add_button ($text, $cb) 1136 $popup->add_button ($text, $cb)
1001 Adds a clickable button to the popup. $cb is called whenever it is 1137 Adds a clickable button to the popup. $cb is called whenever it is
1002 selected. 1138 selected.
1003 1139
1004 $popup->add_toggle ($text, $cb, $initial_value) 1140 $popup->add_toggle ($text, $initial_value, $cb)
1005 Adds a toggle/checkbox item to the popup. Teh callback gets called 1141 Adds a toggle/checkbox item to the popup. The callback gets called
1006 whenever it gets toggled, with a boolean indicating its value as its 1142 whenever it gets toggled, with a boolean indicating its new value as
1007 first argument. 1143 its first argument.
1008 1144
1009 $popup->show 1145 $popup->show
1010 Displays the popup (which is initially hidden). 1146 Displays the popup (which is initially hidden).
1011 1147
1012 The "urxvt::timer" Class 1148 The "urxvt::timer" Class
1018 ->new 1154 ->new
1019 ->interval (1) 1155 ->interval (1)
1020 ->cb (sub { 1156 ->cb (sub {
1021 $term->{overlay}->set (0, 0, 1157 $term->{overlay}->set (0, 0,
1022 sprintf "%2d:%02d:%02d", (localtime urxvt::NOW)[2,1,0]); 1158 sprintf "%2d:%02d:%02d", (localtime urxvt::NOW)[2,1,0]);
1023 }); 1159 });
1024 1160
1025 $timer = new urxvt::timer 1161 $timer = new urxvt::timer
1026 Create a new timer object in started state. It is scheduled to fire 1162 Create a new timer object in started state. It is scheduled to fire
1027 immediately. 1163 immediately.
1028 1164
1116 ->new 1252 ->new
1117 ->start ($pid) 1253 ->start ($pid)
1118 ->cb (sub { 1254 ->cb (sub {
1119 my ($pw, $exit_status) = @_; 1255 my ($pw, $exit_status) = @_;
1120 ... 1256 ...
1121 }); 1257 });
1122 1258
1123 $pw = new urxvt::pw 1259 $pw = new urxvt::pw
1124 Create a new process watcher in stopped state. 1260 Create a new process watcher in stopped state.
1125 1261
1126 $pw = $pw->cb (sub { my ($pw, $exit_status) = @_; ... }) 1262 $pw = $pw->cb (sub { my ($pw, $exit_status) = @_; ... })

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines