(and controlled by the same set-titles option). GitHub issue 3127.
-/* $OpenBSD: server-client.c,v 1.392 2022/03/08 12:01:19 nicm Exp $ */
+/* $OpenBSD: server-client.c,v 1.393 2022/03/24 09:05:57 nicm Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicholas.marriott@gmail.com>
static void server_client_check_redraw(struct client *);
static void server_client_check_modes(struct client *);
static void server_client_set_title(struct client *);
+static void server_client_set_path(struct client *);
static void server_client_reset_state(struct client *);
static int server_client_assume_paste(struct session *);
static void server_client_update_latest(struct client *);
}
if (c->flags & CLIENT_ALLREDRAWFLAGS) {
- if (options_get_number(s->options, "set-titles"))
+ if (options_get_number(s->options, "set-titles")) {
server_client_set_title(c);
+ server_client_set_path(c);
+ }
screen_redraw_screen(c);
}
format_free(ft);
}
+/* Set client path. */
+static void
+server_client_set_path(struct client *c)
+{
+ struct session *s = c->session;
+ const char *path;
+
+ if (s->curw == NULL)
+ return;
+ if (s->curw->window->active->base.path == NULL)
+ path = "";
+ else
+ path = s->curw->window->active->base.path;
+ if (c->path == NULL || strcmp(path, c->path) != 0) {
+ free(c->path);
+ c->path = xstrdup(path);
+ tty_set_path(&c->tty, c->path);
+ }
+}
+
/* Dispatch message from client. */
static void
server_client_dispatch(struct imsg *imsg, void *arg)
-.\" $OpenBSD: tmux.1,v 1.884 2022/03/17 11:35:37 nicm Exp $
+.\" $OpenBSD: tmux.1,v 1.885 2022/03/24 09:05:57 nicm Exp $
.\"
.\" Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
.\"
.\" IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
.\" OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
-.Dd $Mdocdate: March 17 2022 $
+.Dd $Mdocdate: March 24 2022 $
.Dt TMUX 1
.Os
.Sh NAME
Supports
.Xr xterm 1
mouse sequences.
+.It osc7
+Supports the OSC 7 working directory extension.
.It overline
Supports the overline SGR attribute.
.It rectfill
If
.Em Se
is not set, \&Ss with argument 0 will be used to reset the cursor style instead.
+.It Em \&Swd
+Set the opening sequence for the working directory notification.
+The sequence is terminated using the standard
+.Em fsl
+capability.
.It Em \&Sync
Start (parameter is 1) or end (parameter is 2) a synchronized update.
.It Em \&Tc
-/* $OpenBSD: tmux.h,v 1.1165 2022/03/16 17:00:17 nicm Exp $ */
+/* $OpenBSD: tmux.h,v 1.1166 2022/03/24 09:05:57 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
TTYC_SMULX,
TTYC_SMXX,
TTYC_SS,
+ TTYC_SWD,
TTYC_SYNC,
TTYC_TC,
TTYC_TSL,
struct format_job_tree *jobs;
char *title;
+ char *path;
const char *cwd;
char *term_name;
void tty_send_requests(struct tty *);
void tty_stop_tty(struct tty *);
void tty_set_title(struct tty *, const char *);
+void tty_set_path(struct tty *, const char *);
void tty_update_mode(struct tty *, int, struct screen *);
void tty_draw_line(struct tty *, struct screen *, u_int, u_int, u_int,
u_int, u_int, const struct grid_cell *, struct colour_palette *);
-/* $OpenBSD: tty-features.c,v 1.21 2021/12/21 14:57:28 nicm Exp $ */
+/* $OpenBSD: tty-features.c,v 1.22 2022/03/24 09:05:57 nicm Exp $ */
/*
* Copyright (c) 2020 Nicholas Marriott <nicholas.marriott@gmail.com>
0
};
+/* Terminal has OSC 7 working directory. */
+static const char *tty_feature_osc7_capabilities[] = {
+ "Swd=\\E]7;",
+ "fsl=\\a",
+ NULL
+};
+static const struct tty_feature tty_feature_osc7 = {
+ "osc7",
+ tty_feature_osc7_capabilities,
+ 0
+};
+
/* Terminal has mouse support. */
static const char *tty_feature_mouse_capabilities[] = {
"kmous=\\E[M",
&tty_feature_focus,
&tty_feature_margins,
&tty_feature_mouse,
+ &tty_feature_osc7,
&tty_feature_overline,
&tty_feature_rectfill,
&tty_feature_rgb,
-/* $OpenBSD: tty-term.c,v 1.91 2021/08/25 07:37:20 nicm Exp $ */
+/* $OpenBSD: tty-term.c,v 1.92 2022/03/24 09:05:57 nicm Exp $ */
/*
* Copyright (c) 2008 Nicholas Marriott <nicholas.marriott@gmail.com>
[TTYC_SMUL] = { TTYCODE_STRING, "smul" },
[TTYC_SMXX] = { TTYCODE_STRING, "smxx" },
[TTYC_SS] = { TTYCODE_STRING, "Ss" },
+ [TTYC_SWD] = { TTYCODE_STRING, "Swd" },
[TTYC_SYNC] = { TTYCODE_STRING, "Sync" },
[TTYC_TC] = { TTYCODE_FLAG, "Tc" },
[TTYC_TSL] = { TTYCODE_STRING, "tsl" },
-/* $OpenBSD: tty.c,v 1.417 2022/03/08 12:01:19 nicm Exp $ */
+/* $OpenBSD: tty.c,v 1.418 2022/03/24 09:05:57 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
tty_putcode(tty, TTYC_FSL);
}
+void
+tty_set_path(struct tty *tty, const char *title)
+{
+ if (!tty_term_has(tty->term, TTYC_SWD) ||
+ !tty_term_has(tty->term, TTYC_FSL))
+ return;
+
+ tty_putcode(tty, TTYC_SWD);
+ tty_puts(tty, title);
+ tty_putcode(tty, TTYC_FSL);
+}
+
static void
tty_force_cursor_colour(struct tty *tty, int c)
{