Index | Thread | Search

From:
obsd@mulh.net
Subject:
Re: ksh: add OSC7 support
To:
tech@openbsd.org
Date:
Fri, 7 Nov 2025 01:43:04 -0500

Download raw body.

Thread
  • obsd@mulh.net:

    ksh: add OSC7 support

> I use OSC7 in order to advertise the working directory to the
> terminal emulator I use. While I can hack this together in ksh
> with some scripts, it feels like it would be a better fit to
> have directly in the shell, though I'm uncertain about that.

I took up the challenge of how to hack this up in ksh.  Not pretty
but I think it'll work (it outputs the OSC7 escape code as how
I understand them).  This does require jq to do the percent encoding.

pkg_add jq
PS1='\[\e]7;file://\h/$(print -nr -- "$PWD" | jq -sRj @uri)\e\\\\\]\h:$PWD\$ '

(I can only hope the PS1 line doesn't get mangled in sending it)