> So, which option sucks least? TLDR: OSC7 from the shell, IMO.
Given that I use st/zsh on OpenBSD more than Linux and wanted to add some 9term/rc mouse features to its glory, I tried quite a few tricks to get the current shell cwd. I decided on using the OSC7 approach, ie push from the shell to st, which introduced short and generic code in st and seems supported by many shells. I have not tried ksh though but worst case scenario, you need a "cd" alias and some "printf". I have been using it daily without troubles since I published it. Oh, and it's great to be able to use the mouse to plumb any arbitrary string. https://st.suckless.org/patches/right_click_to_plumb/