Notes on cwd-exec.patch
It is worth noting that the cwd-exec.patch relies on the path being set (and updated) in the _NET_WM_NAME property, which has to be configured manually (see for example Bash#Customize title on ArchWiki).
Second note is that : is used as a delimiter separating the path from other text (e.g. terminal name). As a result, the patch does not work with paths containing the delimiter character.
Final note is for everybody who would think of different approach: One could think that another approach is to find out the PID of the active window and resolve the /proc/<pid>/cwd/ symlink to get the path where new process should be spawned. Unfortunately this does not work because the CWD of the terminal process (parent) remains constant and only the CWD of the shell process (child) changes.
Sorry for the long delay before responding. Thanks for noticing the issues.
I do agree that the patch is rather ad-hoc, although I do not quite see how to implement it properly, unless you really keep the cwd of the window when creating it. I would also argue that the overall idea is useful mainly for terminals --- you do something in console, and suddenly you want to offload something to a new window and carry on with whatever you do. In this case tracking the cwd makes sense, where if I have a browser window and I open something else, I don't think it really matters what's the cwd of the new process.
So I would think that we can focus on terminals, and we can even try to catch those cases only. Although I am not sure if there is a reliable way of checking this...
In any case, feel free to make a pull-request with the improvements --- the more advanced heuristics we have the better.
Hey,
I looked at this patch, it did sound very interesting. I tried to implement the patch, it's mostly there, but then realized that the process doesn't work for the program I'm mostly using Emacs as it's one process.
The patch/commit can be found here: https://github.com/Thaodan/i3/commit/61a6b1ee03fd2782f02758339ecd64d894afbc35