From 9638ded3cc2b9494a207a327168612aa9708ad74 Mon Sep 17 00:00:00 2001 From: Sterling Camden Date: Wed, 24 Nov 2010 09:46:20 -0800 Subject: Display status message containing URL for five seconds when launching. --- README | 3 ++- url-picker | 25 +++++++++++++++---------- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/README b/README index d0f79ea..85e9bb8 100644 --- a/README +++ b/README @@ -62,4 +62,5 @@ The backspace key erases the last number typed, if there is one. When a URL is launched, all overlay windows are removed and the cursor position is restored to where it was in the terminal window before -url-picker was invoked. +url-picker was invoked. The url launched is displayed on the bottom +row of the terminal window for five seconds. diff --git a/url-picker b/url-picker index 7c52855..7cb6407 100644 --- a/url-picker +++ b/url-picker @@ -36,16 +36,7 @@ sub on_user_command { } if ($num < 1) { - my $ermsg = $self->overlay(0,-1,35,1,urxvt::OVERLAY_RSTYLE,0); - $ermsg->set(0,0,"url-picker: no URLs found on screen"); - $self->{ermsg} = $ermsg; - $self->{timer} = urxvt::timer - ->new - ->after (5) - ->cb (sub { - $self->{ermsg} = (); - $self->{timer} = (); - }); + $self->status_msg("url-picker: no URLs found on screen"); } else { my $url_picker = {}; $url_picker->{prompt} = $self->overlay( @@ -129,9 +120,23 @@ sub launch { $self->screen_cur($p->{crow},$p->{ccol}); $self->{url_picker} = (); my $launcher = $self->{launcher}; + $self->status_msg($href); $self->exec_async ($launcher,$href); } +sub status_msg { + my ($self, $msg) = @_; + $self->{url_picker_msg} = $self->overlay(0,-1,length($msg),1,urxvt::OVERLAY_RSTYLE,0); + $self->{url_picker_msg}->set(0,0,$msg); + $self->{url_picker_timer} = urxvt::timer + ->new + ->after (5) + ->cb (sub { + $self->{url_picker_msg} = (); + $self->{url_pickertimer} = (); + }); +} + sub on_key_release { my ($self, $event, $keysym) = @_; $self->{url_picker}; -- cgit v1.2.3