src/nnn.c | 14 ++++++++++++++ diff --git a/src/nnn.c b/src/nnn.c index 146acbbbe492c0062200f7fbc3426fec6f6a7406..fc5333108f4735c73f3de7533526ce4facc7568d 100644 --- a/src/nnn.c +++ b/src/nnn.c @@ -446,6 +446,7 @@ static char *listroot; static char *plgpath; static char *pnamebuf, *pselbuf, *findselpos; static char *mark; +static char *hostname; #ifndef NOFIFO static char *fifopath; #endif @@ -6503,6 +6504,9 @@ } #ifndef NOX11 if (cfg.x11 && !g_state.picker) { + /* Signal CWD change to terminal */ + printf("\033]7;file://%s%s\033\\", hostname, path); + /* Set terminal window title */ r = set_tilde_in_path(path); @@ -8113,6 +8117,8 @@ #ifndef NOX11 if (cfg.x11 && !g_state.picker) { printf("\033[23;0t"); /* reset terminal window title */ fflush(stdout); + + free(hostname); } #endif free(selpath); @@ -8548,6 +8554,14 @@ if (cfg.x11 && !g_state.picker) { /* Save terminal window title */ printf("\033[22;0t"); fflush(stdout); + + hostname = malloc(_POSIX_HOST_NAME_MAX + 1); + if (!hostname) { + xerror(); + return EXIT_FAILURE; + } + gethostname(hostname, _POSIX_HOST_NAME_MAX); + hostname[_POSIX_HOST_NAME_MAX] = '\0'; } #endif