On Fri, Sep 19, 2008 at 10:26:40PM +0300, Dan Muresan <[EMAIL PROTECTED]> wrote:
> By a terminal's "current directory", I mean the current dir for the  
> shell embedded in that terminal (as shown by both the bash prompt and  
> the pwd command).

What if you enter that command in a subshell? What if it isn't a shell at
all?

Apart form these problems, there is no way to find the cwd of another
process on unix in general, even if you *knew* the process.

The right solution is to teach your shell to tell urxvt about the cwd and
use that in your extension (for example, by setting an x-property via a
command sequence and querying that before opening a window).

> Let me rephrase my original report: in urxvt terminal A, the "current  
> dir" is /home/muresan.
>
> I run "urxvtd &" in terminal A. I then run urxvtc (also in terminal A)  
> which fires up urxvtc terminal B.
>
> In B, both the prompt and pwd confirm that the current dir is still  
> /home/muresan.

Of course, the cwd of urxvtc is /home/muresan.

> Terminal C opens. In terminal C, both the prompt and pwd show that the  
> current dir is /. The current dirs in A and B remain /home/muresan.

Yes, the cwd of urxvtc in that case is /. urxvtc sends the cwd to urxvtd.

> What causes C to get a current dir of /, instead of /home/muresan like  
> B? I thought exec_async might be to blame, but you're saying that's not 
> it.

/ is simply the cwd of urxvtd, so when you start urxvtc from within
urxvtd, it will use that as cwd.

>     new urxvt::term
>
> Would that re-use the urxvtd associated with the current terminal?  

Yes, but it works just as well within urxvt, both support multiple
terminal windows from a single process.

> Because that was the purpose of the extension (bring up a new urxvtc  
> associated with the same urxvtd as the current terminal).

Yes, it might be a good idea to put this into the default popups as well,
actually.

-- 
                The choice of a       Deliantra, the free code+content MORPG
      -----==-     _GNU_              http://www.deliantra.net
      ----==-- _       generation
      ---==---(_)__  __ ____  __      Marc Lehmann
      --==---/ / _ \/ // /\ \/ /      [EMAIL PROTECTED]
      -=====/_/_//_/\_,_/ /_/\_\

_______________________________________________
rxvt-unicode mailing list
[email protected]
http://lists.schmorp.de/cgi-bin/mailman/listinfo/rxvt-unicode

Reply via email to