You are not logged in.

#26 2010-08-15 08:05:06

StephenB
Member
From: UK
Registered: 2010-04-25
Posts: 18

Re: urxvt-url-select - open/copy URLs in urxvt using only the keyboard

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

#27 2010-08-15 13:42:45

ber_t
Member
From: Berlin, Germany
Registered: 2010-03-10
Posts: 214
Website

Re: urxvt-url-select - open/copy URLs in urxvt using only the keyboard

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

#28 2010-08-16 18:28:56

ber_t
Member
From: Berlin, Germany
Registered: 2010-03-10
Posts: 214
Website

Re: urxvt-url-select - open/copy URLs in urxvt using only the keyboard

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

#29 2010-08-16 20:54:31

ablepharus
Member
From: Berlin
Registered: 2010-05-23
Posts: 129

Re: urxvt-url-select - open/copy URLs in urxvt using only the keyboard

Works very well, thanks for this! And also thanks for uploading it to aur.

Offline

#30 2010-08-17 09:33:31

livibetter
Member
From: Taipei
Registered: 2008-05-14
Posts: 95
Website

Re: urxvt-url-select - open/copy URLs in urxvt using only the keyboard

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

#31 2010-08-17 15:26:08

ber_t
Member
From: Berlin, Germany
Registered: 2010-03-10
Posts: 214
Website

Re: urxvt-url-select - open/copy URLs in urxvt using only the keyboard

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...

Offline

#32 2010-08-17 18:15:42

livibetter
Member
From: Taipei
Registered: 2008-05-14
Posts: 95
Website

Re: urxvt-url-select - open/copy URLs in urxvt using only the keyboard

ber_t wrote:
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! big_smile

Offline

#33 2010-08-27 15:31:26

Ogion
Member
From: Germany
Registered: 2007-12-11
Posts: 367

Re: urxvt-url-select - open/copy URLs in urxvt using only the keyboard

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

#34 2010-08-28 08:50:07

Ogion
Member
From: Germany
Registered: 2007-12-11
Posts: 367

Re: urxvt-url-select - open/copy URLs in urxvt using only the keyboard

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

#35 2010-08-29 18:51:02

ber_t
Member
From: Berlin, Germany
Registered: 2010-03-10
Posts: 214
Website

Re: urxvt-url-select - open/copy URLs in urxvt using only the keyboard

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

#36 2010-09-12 09:01:45

dcc24
Member
Registered: 2009-10-31
Posts: 732

Re: urxvt-url-select - open/copy URLs in urxvt using only the keyboard

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)

My AUR packages

Offline

#37 2010-09-12 11:22:59

AddiKT1ve
Member
From: France
Registered: 2008-08-22
Posts: 47
Website

Re: urxvt-url-select - open/copy URLs in urxvt using only the keyboard

Excellent, thanks a lot!


##hippie irc.freenode.net

Offline

#38 2010-09-12 17:59:04

rent0n
Member
From: Italy
Registered: 2009-10-29
Posts: 457
Website

Re: urxvt-url-select - open/copy URLs in urxvt using only the keyboard

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. smile

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

#39 2010-09-12 18:35:21

ber_t
Member
From: Berlin, Germany
Registered: 2010-03-10
Posts: 214
Website

Re: urxvt-url-select - open/copy URLs in urxvt using only the keyboard

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

#40 2010-09-12 20:31:39

rent0n
Member
From: Italy
Registered: 2009-10-29
Posts: 457
Website

Re: urxvt-url-select - open/copy URLs in urxvt using only the keyboard

ber_t wrote:

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

#41 2010-09-14 15:39:49

rent0n
Member
From: Italy
Registered: 2009-10-29
Posts: 457
Website

Re: urxvt-url-select - open/copy URLs in urxvt using only the keyboard

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

#42 2010-09-14 17:32:54

steve___
Member
Registered: 2008-02-24
Posts: 452

Re: urxvt-url-select - open/copy URLs in urxvt using only the keyboard

fwiw - I have been using this extension quite extensively with urxtd+firefox and have had no issues.

Offline

#43 2010-09-16 07:53:25

ber_t
Member
From: Berlin, Germany
Registered: 2010-03-10
Posts: 214
Website

Re: urxvt-url-select - open/copy URLs in urxvt using only the keyboard

rent0n wrote:

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

#44 2011-06-17 18:12:46

x33a
Forum Fellow
Registered: 2009-08-15
Posts: 4,587

Re: urxvt-url-select - open/copy URLs in urxvt using only the keyboard

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

Board footer

Powered by FluxBB