On Sun, Jul 01, 2012 at 06:29:13PM +0200, Martin Pohlack wrote:
> Hi Romildo,
>
> On 01.07.2012 16:29, José Romildo Malaquias wrote:
> >
> > Suppose I have a window running rxvt-unicode. I would like to be able to
> > have a new window running rxvt-unicode on the same directory of the
> > current one.
>
> With "current one", you probably mean the current *shell* running in
> your terminal and not the cwd of the terminal itself?
Yes.
> Then you could write a simple perl plugin, using some hackery from the
> selection plugin:
[...]
> > Something like C-S-n on gnome-terminal.
I have tried with the sugested code. The plugin is attached.
But I am not a Perl programmer neither an expert on urxvt. So it the
plugin needs some fixes.
Currently it runs, but gives some messages:
$ urxvt --perl-lib ${HOME}/.urxvt -pe urxvt-new-window
urxvt: perl hook 0 evaluation error: /home/romildo/.urxvt/ext/urxvt-new-window:
Global symbol "$self" requires explicit package name at
/home/romildo/.urxvt/ext/urxvt-new-window line 18, <$fh> line 1.
Also, the original urxvt window prompt is blocked until the new urxvt
window is closed.
So I need help to finish the plugin.
Regards.
Romildo
#!/usr/bin/env perl
use strict;
use warnings;
use Cwd;
# Openning a new window.
# José Romildo Malaquias <[email protected]>
# References: man 3 urxvtperl
# Debugging: urxvt --perl-lib ${HOME}/.urxvt -pe new-window
sub new_window
{
my $ccwd = readlink("/proc/".$self->{child_pid}."/cwd");
exec("urxvt", "-cd", "$ccwd");
}
sub on_child_start {
my ($self,$pid) = @_;
$self->{child_pid} = $pid; # keep for later determining our shells
# CWD for relative path names
()
}
sub on_user_command
{
my ($self, $cmd) = @_;
if ($cmd eq "new-window") {
new_window($self);
}
}
_______________________________________________
rxvt-unicode mailing list
[email protected]
http://lists.schmorp.de/cgi-bin/mailman/listinfo/rxvt-unicode