aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Lublin <daniel@lublin.se>2019-02-04 11:09:14 +0100
committerDaniel Lublin <daniel@lublin.se>2019-02-04 11:09:14 +0100
commit1c7abb93eb39417fcf81c67875bfd804f3458a1a (patch)
treeeec9248fd41bf037c6632f25758ccf8363bff0e1
parentbf659da8f25080bb2e90ebf37059af9b9305cf93 (diff)
Add launchsingle option
-rw-r--r--README5
-rw-r--r--url-picker5
2 files changed, 9 insertions, 1 deletions
diff --git a/README b/README
index 4579604..06cf28a 100644
--- a/README
+++ b/README
@@ -72,6 +72,10 @@ position is restored to where it was in the terminal window before
url-picker was invoked. The url launched is displayed on the bottom
row of the terminal window for five seconds.
+To avoid surprises, the resource `url-picker.launchsingle` can be set to
+`false` to stop url-picker from automatically launching a single (sole) found
+URL, until its number has been typed.
+
RESOURCES
The following resources are recognized by url-picker:
@@ -82,6 +86,7 @@ URxvt.url-picker.input.foregroundColor Fg color for numbers typed
URxvt.url-picker.label.backgroundColor Bg color for numbered labels
URxvt.url-picker.label.foregroundColor Fg color for numbered labels
URxvt.url-picker.launcher Browser override
+URxvt.url-picker.launchsingle "false" to not auto-launch single url
URXVT.url-picker.order "descending" numbers in reverse
URxvt.url-picker.prompt.backgroundColor Bg color for "Follow:" prompt
URxvt.url-picker.prompt.foregroundColor Fg color for "Follow:" prompt
diff --git a/url-picker b/url-picker
index 0ce4838..fab9359 100644
--- a/url-picker
+++ b/url-picker
@@ -151,7 +151,9 @@ sub update {
$overlay->hide;
}
}
- if (scalar(@matches) == 1) {
+ # Auto-launch a single url only if the launchsingle resource is true
+ # (default), or if some digits were input
+ if (scalar(@matches) == 1 && ($self->{launchsingle} || $len > 0)) {
$self->launch(@matches[0]);
} else {
$self->screen_cur($self->nrow,8+$len);
@@ -206,6 +208,7 @@ sub on_start {
$self->{launcher} = $self->my_resource("launcher") ||
$self->x_resource("url-launcher") ||
"sensible-browser";
+ $self->{launchsingle} = ($self->my_resource("launchsingle") ne "false");
$self->{descending} = ($self->my_resource("order") eq "descending");
$self->{url_picker} = ();
}