You are not logged in.
Okay, it must be something wrong with xmonad or my config. A quick fix for me is to have the mouse always following the focus.
Thanks for the quick replies. I've removed the note from the wiki about mouse having to be over the window.
Offline
Updated to version 1.2
Display a small overlay in the bottom right corner of the terminal, which shows the index of the current selected URL.
Now there's only one TODO left: handle window resizes...
Offline
Updated to version 1.3
The overlay in the bottom right corner looks a bit more vim-like...
There's no possibility for handling window resizes in a way to prevent all possible changes/fuckups, so I'm not willing to try it anymore. Just don't resize your terminal window while URL selection mode is active unless you like to lose the current selection...
So for now url-select is feature complete. I don't plan any more updates, besides bug fixes and feature requests posted here or on GitHub.
Have fun...
Bert
Offline
Works very well, thanks for this! And also thanks for uploading it to aur.
Offline
I want to ask for some features.
1) Resume the last opened link position (if screen isn't updated) or a new key (like Shift+Return) to open but still stay in url-select mode. I usually need to open more than a link from a screen. After open a link, I have to j/k go back to previous link then open the next, it takes some time.
2) Customizable keybindings? I want to add a new key Q for exiting url-select. I use urxvt with tmux and Q key can exit some special modes of tmux. Escape key is farther than Q key, it's not so easy to press it. Is that possible we can add/change keybindings in .Xdefault for url-select, or can you simply add Q key to url-select for exiting?
Thanks!
Offline
1) Resume the last opened link position (if screen isn't updated) or a new key (like Shift+Return) to open but still stay in url-select mode. I usually need to open more than a link from a screen. After open a link, I have to j/k go back to previous link then open the next, it takes some time.
I added the second suggestion, because it's a lot easier. But I used 'o' for that, because I don't liked Shift-Return.
2) Customizable keybindings? I want to add a new key Q for exiting url-select. I use urxvt with tmux and Q key can exit some special modes of tmux. Escape key is farther than Q key, it's not so easy to press it. Is that possible we can add/change keybindings in .Xdefault for url-select, or can you simply add Q key to url-select for exiting?
Cusomizable keymappings need too much effort for such a little script, so you have to get used to the defaults or edit the script for yourself. But because you're damn right about the unreachable Escape key, I've added 'q' to do the same.
I have not created a package, yet. Please use the one in the master branch...
Offline
livibetter wrote:1) Resume the last opened link position (if screen isn't updated) or a new key (like Shift+Return) to open but still stay in url-select mode. I usually need to open more than a link from a screen. After open a link, I have to j/k go back to previous link then open the next, it takes some time.
I added the second suggestion, because it's a lot easier. But I used 'o' for that, because I don't liked Shift-Return.
livibetter wrote:2) Customizable keybindings? I want to add a new key Q for exiting url-select. I use urxvt with tmux and Q key can exit some special modes of tmux. Escape key is farther than Q key, it's not so easy to press it. Is that possible we can add/change keybindings in .Xdefault for url-select, or can you simply add Q key to url-select for exiting?
Cusomizable keymappings need too much effort for such a little script, so you have to get used to the defaults or edit the script for yourself. But because you're damn right about the unreachable Escape key, I've added 'q' to do the same.
I have not created a package, yet. Please use the one in the master branch...
Thanks a lot! Now it's all perfect to me!
Offline
Ber_t, i got a question. Today i noticed by accident that your url_matcher regex does not match for example german umlaute (öäü) and other unicode characters. Mainly probably because you don't use utf8; and use a-z ffor the letters. I tried to replace your regex witht he one from daringfireball, because it specifically also matches unicode characters. But i failed. Somehow it then sometimes starts to complaing from non declared variables (as if there wasn't a "my") or it fails silently.
If you could take a look at it that would be great.
Thanks.
Ogion
(my-dotfiles)
"People willing to trade their freedom for temporary security deserve neither and will lose both." - Benjamin Franklin
"Enlightenment is man's leaving his self-caused immaturity." - Immanuel Kant
Offline
Ok, i got it to work properly with the regex from daringfireball replacing yours and commenting out that CommonUrl perl module stuff.
a git diff of my modified url-select to your latests git version
diff --git a/url-select b/url-select
index 517c65a..f97d2cc 100644
--- a/url-select
+++ b/url-select
@@ -26,22 +26,25 @@
use strict;
+use utf8;
-my $url_matcher = qr{(
- (?:https?://|ftp://|news://|mailto:|file://|www\.)
- [ab-zA-Z0-9\-\@;\/?:&=%\$_.+!*\x27(),~#]+[ab-zA-Z0-9\-\@;\/?&=%\$_+!*\x27()~]
-)}x;
+#my $url_matcher = qr{(
+ #(?:https?://|ftp://|news://|mailto:|file://|www\.)
+ #[\S\-\@;\/?:&=%\$_.+!*\x27(),~#]+[\S\-\@;\/?&=%\$_+!*\x27()~]
+#)}x;
+
+my $url_matcher = qr{(?i)\b((?:[a-z][\w-]+:(?:/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?«»""'']))};
sub on_start {
my ($self) = @_;
- eval { require Regexp::Common::URI };
- if(!$@) {
- require Regexp::Common;
- Regexp::Common->import('URI');
- $url_matcher = $Regexp::Common::RE{URI}{HTTP};
- }
+ #eval { require Regexp::Common::URI };
+ #if(!$@) {
+ #require Regexp::Common;
+ #Regexp::Common->import('URI');
+ #$url_matcher = $Regexp::Common::RE{URI}{HTTP};
+ #}
# read resource settings
$self->{browser} = $self->x_resource('urlLauncher') || 'x-www-browser';
@@ -63,7 +66,7 @@ sub line_update {
while ($text =~ /$url_matcher/g) {
my $url = $1;
my ($beg, $end) = ($-[1], $+[1] - 1);
- --$end if $url =~ /["')]$/;
+ #--$end if $url =~ /["')]$/;
for (@{$rend}[$beg .. $end]) {
$_ |= urxvt::RS_Uline;
@@ -173,7 +176,7 @@ sub select_next {
do {
my ($beg, $end) = ($-[0], $+[0]);
- --$end if $& =~ /['")]$/;
+ #--$end if $& =~ /['")]$/;
push @{$self->{found}}, [$line->coord_of($beg),
$line->coord_of($end), substr($text, $beg, $end - $beg)];
} while ($text =~ /$url_matcher/g);
Ogion
(my-dotfiles)
"People willing to trade their freedom for temporary security deserve neither and will lose both." - Benjamin Franklin
"Enlightenment is man's leaving his self-caused immaturity." - Immanuel Kant
Offline
Thanks Ogion, I didn't have much time recently, but I will eventually try your new url regex and maybe include your patch in the next version.
EDIT: I've tested the regex from daringfireball, but I won't apply the patch, because it falsely detects a lot of non-url text like my "host:pwd $" command prompt as an url. I've replaced the 'A-Za-z0-9' ranges inside the character classes with '\w', which should fix the unicode character problem mentioned by Ogion.
Last edited by ber_t (2010-08-31 09:40:36)
Offline
I can also confirm the "mouse over window" problem. I'm using xfwm standalone, and if the pointer is not on the urxvt window, Meta-U doesn't work at all.
It is better to keep your mouth shut and be thought a fool than to open it and remove all doubt. (Mark Twain)
Offline
Excellent, thanks a lot!
##hippie irc.freenode.net
Offline
Great, thanks for this!
I can confirm that Alt-U works only when the mouse pointer is over the window in openbox (with focus follows mouse mode) too.
A bit annoying to say the least.
Last edited by rent0n (2010-09-12 18:03:46)
rent0n@deviantART | rent0n@bitbucket | rent0n@identi.ca | LRU #337812
aspire: Acer Aspire 5920 Arch Linux x86_64 | beetle: Gericom Beetle G733 Arch Linux i686
Offline
Updated to version 1.3
Included the recent changes already mentioned here: q and o mappings, fix for umlauts in URLs.
Can someone having problems activating it, with the mouse cursor not over the window using sloppy focus please try the Meta-S search functionality, provided by the searchable-scrollback extension included in the default set? If you could activate this one, but Meta-U does not work for you, then I am to blame and I will look into it. Otherwise the bug is in the urxvt perl handler and I couldn't do anything about it.
Offline
Updated to version 1.3
Included the recent changes already mentioned here: q and o mappings, fix for umlauts in URLs.
Can someone having problems activating it, with the mouse cursor not over the window using sloppy focus please try the Meta-S search functionality, provided by the searchable-scrollback extension included in the default set? If you could activate this one, but Meta-U does not work for you, then I am to blame and I will look into it. Otherwise the bug is in the urxvt perl handler and I couldn't do anything about it.
Yes you're right. The search function with Alt-S suffers exactly from the same issue, so the problem must be in the perl handler and not in url-select.
rent0n@deviantART | rent0n@bitbucket | rent0n@identi.ca | LRU #337812
aspire: Acer Aspire 5920 Arch Linux x86_64 | beetle: Gericom Beetle G733 Arch Linux i686
Offline
Hi ber_t,
I'm afraid I found a quite annoying bug, that, unfortunately I can hardly reproduce (I'm not even sure how to reproduce it).
Basically I use urxvtd with several urxvtc instances. Sometimes, but not always, when I press Enter to open a link (and not before, say when you press Alt-U or scroll up/down with j/k) urxvtd crashes closing all opened urxvtc. Also, the url doesn't open in firefox.
I hope someone can confirm this and maybe find a way to reproduce so you can work on it.
Just to let you know, urxvt-mark-yank-url never suffered from this issue.
Thanks for your work!
rent0n@deviantART | rent0n@bitbucket | rent0n@identi.ca | LRU #337812
aspire: Acer Aspire 5920 Arch Linux x86_64 | beetle: Gericom Beetle G733 Arch Linux i686
Offline
fwiw - I have been using this extension quite extensively with urxtd+firefox and have had no issues.
Offline
Basically I use urxvtd with several urxvtc instances. Sometimes, but not always, when I press Enter to open a link (and not before, say when you press Alt-U or scroll up/down with j/k) urxvtd crashes closing all opened urxvtc. Also, the url doesn't open in firefox.
I hope someone can confirm this and maybe find a way to reproduce so you can work on it.
Just to let you know, urxvt-mark-yank-url never suffered from this issue.
Thanks for your help, but like steve__ I've never had this problem. Could you run your urxvtd and all the urxvtc from a console or another terminal? This way, you might get an error message, because normally when an extension fails, the urxvt perl handler prints something meaningful to stdout.
Offline
Hello ber_t,
First of all thanks for this extension, it was one of the reasons i switched to urxvt.
Secondly, i found recently that it doesn't work properly with wrapped urls. It only yanks the top line and ignores the rest of the url. Can you do something about it?
Thanks
Last edited by x33a (2011-06-17 18:16:51)
Offline