Appreciate your response. I've *finally* got my solution working, which is slightly more generic in that it works with any currently active window, uxrvt or otherwise. And I'm looking to extend it to use the :cd of vim as Riccardo alluded to earlier.
Appreciate the responses from everyone. On 8 September 2014 17:47, Meyer <[email protected]> wrote: > There might be a configuration for urxvt that sets the window title? > > This is what I use. It'll look at each terminal window on the current > tag, figure out the path, and then spawn a new terminal setting the > working directory to whatever was found to be the most common path. > Apologies for the poor formatting. > > -- Opens a terminal in the most common CWD for this tag > awful.key({ modkey, }, "Return", > function () > paths = {} > pathname = "" > most_common_num = 0 > most_common_str = "" > current_tag = tags[mouse.screen][awful.tag.getidx()] > for _, c in pairs(current_tag:clients()) do > pid = c.pid > if string.find(c.name, "Terminal") then > pathname = string.sub(c.name, 26) > if paths[pathname] == nil then > paths[pathname] = 1 > else > paths[pathname] = paths[pathname] + 1 > end > if paths[pathname] > most_common_num then > most_common_num = paths[pathname] > most_common_str = pathname > end > end > end > expanded_str = most_common_str:gsub("~", os.getenv("HOME") .. "/") > awful.util.spawn("xfce4-terminal --working-directory=\"" .. > expanded_str .. "\"") > end), > > On Mon, Sep 8, 2014 at 12:39 PM, Paul Jolly <[email protected]> wrote: > > That's a great thought: please can you share the relevant part of your > > rc.lua? > > > > On 8 September 2014 17:15, Meyer <[email protected]> wrote: > >> > >> Does urxvt not change the window title to follow the CWD? I use > >> xfce4-terminal and just parse out the path from the window title. > >> It's hacky but it works, and is just a couple extra lines in rc.lua > >> (no external program needed). > >> > >> On Mon, Sep 8, 2014 at 12:03 PM, Ian Thompson <[email protected]> > wrote: > >> > > >> > On Mon, Sep 8, 2014 at 11:58 AM, Paul Jolly <[email protected]> > wrote: > >> > awful.util.spawn("/home/myitcv/bin/newshell -p " .. > >> > awful.client.focus.pid .. " '-e /home/myitcv/bin/unshare_mounts'") > >> > > >> > > >> > The variable is client.focus.pid, not awful.client.focus.pid. I don't > >> > really > >> > understand why it's different, but it is. > >> > > >> > Ian > >> > >> -- > >> To unsubscribe, send mail to [email protected]. > > > > >
