Home
Reading
Searching
Subscribe
Sponsors
Statistics
Posting
Contact
Spam
Lists
Links
About
Hosting
Filtering
Features Download
Marketing
Archives
FAQ
Blog
 
Gmane
From: Martin Pohlack <mp26-IG//nw+yl+iQIjdd1DhZXWfrygkm6VTR <at> public.gmane.org>
Subject: Re: Run another rxvt-unicode on the same directory
Newsgroups: gmane.comp.terminal-emulators.rxvt-unicode.general
Date: Sunday 1st July 2012 16:29:13 UTC (over 5 years ago)
Hi Romildo,

On 01.07.2012 16:29, José Romildo Malaquias wrote:
> Hello.
> 
> 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?

Then you could write a simple perl plugin, using some hackery from the
selection plugin:

Track term's child (typically the shell):
----------------------------------------------------------------------
sub on_child_start {
   my ($self,$pid) = @_;

   $self->{child_pid} = $pid;  # keep for later determining our shells
                               # CWD for relative path names

   ()
}
----------------------------------------------------------------------

Make use of this:
----------------------------------------------------------------------
...
      my $ccwd = readlink("/proc/".$self->{child_pid}."/cwd");
      // start new terminal here with parameter "-cd $ccwd"
...
----------------------------------------------------------------------

> Something like C-S-n on gnome-terminal.
> 
> Is this easily achievable?

The obvious limitation is, that only the first shell level's path will
be detected.  A nested bash or a nested mc's paths will not be seen.

HTH,
Martin
 
CD: 4ms