coords - weechat script to map screen coordinates (weechat edition)
first, copy the file to your .weechat/perl directory. Then you can type
/script load coords.pl
in weechat to load the script. Use
/coords
to open the coords screen, or conveniently
/key bind meta-/ /coords /
to open it with the Alt+/ keybinding.
coords will hilight links, allow text selection and tries to send the selection to xterm
if you would like urls to be copied into the selection clipboard, add
xterm*disallowedWindowOps:20,21,SetXprop
to your .Xresources file for xterm.
For rxvt-unicode, get the osc-xterm-clipboard script from http://anti.teamidiot.de/static/nei/*/Code/urxvt/, install it to your perl-lib directory and add it to your .Xresources like such:
URxvt.perl-ext-common: default,osc-xterm-clipboard
to open the url overlay on a window, type /coords
or use the keybinding you created as explained in the "SYNOPSIS".
by default, the copy window will be in selection mode. you can move the text cursor with the arrow keys and open a selection with the Space key. The selection content will be transfered into clipboard.
to switch between selection mode and URL mode, use the /
key or type the command /coords /
to directly start in URL mode.
inside the overlay, you can use Arrow-Up and Arrow-Down keys to select URLs. This script will try to copy them into your selection clipboard (see "SETUP") so you should be able to open the selected link by clicking the middle mouse button in your browser.
once you click or hit enter, an url open signal will be sent to WeeChat. Use an appropriate script such as urlopener.pl from http://anti.teamidiot.de/static/nei/*/Code/WeeChat/ if you would like to associate this with some application (web browser etc.)
to leave the overlay, hit the q
key.
for mouse support, this script will listen to mouse input signals. Another script is needed to supply these signals, such as mouse.pl which can be found in the same place as urlopener.pl and this script.
xterm_compatible
to your $TERM if you think it does.the settings are usually found in the
plugins.var.perl.coords
namespace, that is, type
/set plugins.var.perl.coords.*
to see them and
/set plugins.var.perl.coords.SETTINGNAME VALUE
to change a setting SETTINGNAME
to a new value VALUE
. Finally,
/unset plugins.var.perl.coords.SETTINGNAME
will reset a setting to its default value.
the following settings are available:
a regular expression to identify URLs in the text. See perlre for more information about Perl regular expressions.
parenthesis-like characters which nest and should be excluded when found around an URL. make sure the variable setting nests properly when modifying this.
this is matched against the end of a link and removed
make nicks to hyperlinks for menu/pm
make channels to hyperlinks for join
set to types of hyperlinks that are shown by default
use nick menu when opening nick hyperlink (see hyper_nicks, requires menu.pl script). otherwise open private message. this setting only applies to text mode selection, for mouse see mouse.nick_2nd_click
the weechat color and/or attribute to be used for highlighting URLs in the copy window. seperate multiple attributes with .
the same as color.url_highlight except for the currently (using arrow keys) selected link.
the weechat color and/or attribute to be used for the text cursor.
the color of the currently selected text in selection mode
short_name to use for coords buffer. it is set to the copy sign by default to not disturb buffers bar width, set to the empty string to have window position and size shown
set to on if it should be possible to directly click on URLs and select text, set to off if mouse should only work in open coords buffer
set to on or a delay (in ms) to autoclose coords buffer opened by copy_on_click on button release, set to off if the coords buffer should stay open after click
set to on to use the mouse to select windows
set to on if copy_on_click should work on inactive windows (works only if click_select_pane is set too). set to off if window needs to be active
if this is set, URLs are only opened when clicked twice (in the same incarnation of a coords buffer) instead of on first click. it can be set to a delay (in ms) that will be added to the close_on_release delay if the script is waiting for a second click on the URL to happen
set to on if coords should handle scrolling inside windows. the script will try to guess non-chat areas to be nicklist, top to be title and bottom to be status and scroll the respective bars if the cursor is in that area. set to off if scrolling should be handled by the default mouse.pl script or another mouse scrolling script
set to on if inactive windows should be scrolled instead of active window if the mouse cursor is over it (requires handle_scroll to be enabled)
if you set this, an external program may be executed to store the selection or URL. begin with |
to pipe into program or use parameters %s
for text, %q
for quoted text or %x
for quoted escape sequence.
You can define custom key bindings to use inside the copywin here. syntax is: command-letter:weechat-keycode. available commands: -+>< (up/down/left/right) fbae (forward word/backward word/beginning/end) !@ (open/start selection) /UNCunc (toggle highlights/urls/nicks/channels) q (close window)
for full pod documentation, filter this script with
perl -pE' (s/^## (.*?) -- (.*)/=head2 $1\n\n$2\n\n=over\n/ and $o=1) or s/^## (.*?) - (.*)/=item I<$1>\n\n$2\n/ or (s/^## (.*)/=back\n\n$1\n\n=cut\n/ and $o=0,1) or ($o and $o=0,1 and s/^sub /=back\n\n=cut\n\nsub /)'