diff --git a/url-select b/url-select index 1daea11..ee18d36 100644 --- a/url-select +++ b/url-select @@ -14,15 +14,15 @@ # URxvt.keysym.M-u: perl:url-select:select_next # Use Meta-u to activate URL selection mode, then use the following keys: -# k: select next upward URL (also with Meta-u) -# j: select next downward URL -# Return: open selected URL in browser and quit selection mode -# y: copy (yank) selected URL and quit selection mode -# Escape: cancel URL selection mode +# k: Select next upward URL (also with Meta-u) +# j: Select next downward URL +# o/Return: Open selected URL in browser, Return: deactivate afterwards +# y: Copy (yank) selected URL and deactivate selection mode +# q/Escape: Deactivate URL selection mode # Options: -# URxvt.urlLauncher: browser/command to open selected URL with -# URxvt.underlineURLs: if set to true, all URLs get underlined +# URxvt.urlLauncher: Browser/command to open selected URL with +# URxvt.underlineURLs: If set to true, all URLs get underlined use strict; @@ -95,13 +95,11 @@ sub key_press { my ($self, $event, $keysym) = @_; my $char = chr($keysym); - if ($keysym == 0xff1b) { - # escape + if ($keysym == 0xff1b || lc($char) eq 'q') { deactivate($self); - } elsif ($keysym == 0xff0d) { - # return + } elsif ($keysym == 0xff0d || $char eq 'o') { $self->exec_async($self->{browser}, ${$self->{found}[$self->{n}]}[4]); - deactivate($self); + deactivate($self) unless $char eq 'o'; } elsif ($char eq 'y') { $self->selection(${$self->{found}[$self->{n}]}[4]); $self->selection_grab($event->{time});