Show xterm title on option '-x'

This commit is contained in:
Arun Prakash Jana 2021-04-13 16:20:28 +05:30
parent 285463253c
commit 5bfc868321
4 changed files with 9 additions and 8 deletions

View file

@ -42,5 +42,5 @@ complete -c nnn -s u -d 'use selection (no prompt)'
complete -c nnn -s U -d 'show user and group' complete -c nnn -s U -d 'show user and group'
complete -c nnn -s V -d 'show program version and exit' complete -c nnn -s V -d 'show program version and exit'
complete -c nnn -s w -d 'hardware cursor mode' complete -c nnn -s w -d 'hardware cursor mode'
complete -c nnn -s x -d 'notis, sel to system clipboard' complete -c nnn -s x -d 'notis, sel to system clipboard, xterm title'
complete -c nnn -s h -d 'show program help' complete -c nnn -s h -d 'show program help'

View file

@ -40,7 +40,7 @@ args=(
'(-U)-U[show user and group]' '(-U)-U[show user and group]'
'(-V)-V[show program version and exit]' '(-V)-V[show program version and exit]'
'(-w)-C[hardware cursor mode]' '(-w)-C[hardware cursor mode]'
'(-x)-x[notis, sel to system clipboard]' '(-x)-x[notis, sel to system clipboard, xterm title]'
'(-h)-h[show program help]' '(-h)-h[show program help]'
'*:filename:_files' '*:filename:_files'
) )

1
nnn.1
View file

@ -140,6 +140,7 @@ supports the following options:
.Fl x .Fl x
show notis on selection cp, mv, rm completion show notis on selection cp, mv, rm completion
copy path to system clipboard on select copy path to system clipboard on select
show xterm title
.Pp .Pp
.Fl h .Fl h
show program help and exit show program help and exit

View file

@ -303,7 +303,7 @@ typedef struct {
uint_t useeditor : 1; /* Use VISUAL to open text files */ uint_t useeditor : 1; /* Use VISUAL to open text files */
uint_t reserved3 : 3; uint_t reserved3 : 3;
uint_t regex : 1; /* Use regex filters */ uint_t regex : 1; /* Use regex filters */
uint_t x11 : 1; /* Copy to system clipboard and show notis */ uint_t x11 : 1; /* Copy to system clipboard, show notis, xterm title */
uint_t timetype : 2; /* Time sort type (0: access, 1: change, 2: modification) */ uint_t timetype : 2; /* Time sort type (0: access, 1: change, 2: modification) */
uint_t cliopener : 1; /* All-CLI app opener */ uint_t cliopener : 1; /* All-CLI app opener */
uint_t waitedit : 1; /* For ops that can't be detached, used EDITOR */ uint_t waitedit : 1; /* For ops that can't be detached, used EDITOR */
@ -5914,7 +5914,7 @@ begin:
setdirwatch(); setdirwatch();
} }
if (!g_state.picker) { if (cfg.x11) {
/* Set terminal window title */ /* Set terminal window title */
r = set_tilde_in_path(path); r = set_tilde_in_path(path);
@ -7405,7 +7405,7 @@ static void usage(void)
#endif #endif
" -V show version\n" " -V show version\n"
" -w place HW cursor on hovered\n" " -w place HW cursor on hovered\n"
" -x notis, sel to system clipboard\n" " -x notis, sel to clipboard, xterm title\n"
" -h show help\n\n" " -h show help\n\n"
"v%s\n%s\n", __func__, VERSION, GENERAL_INFO); "v%s\n%s\n", __func__, VERSION, GENERAL_INFO);
} }
@ -7512,7 +7512,7 @@ static bool set_tmp_path(void)
static void cleanup(void) static void cleanup(void)
{ {
if (!g_state.picker) { if (cfg.x11) {
printf("\033[23;0t"); /* reset terminal window title */ printf("\033[23;0t"); /* reset terminal window title */
fflush(stdout); fflush(stdout);
} }
@ -7931,7 +7931,7 @@ int main(int argc, char *argv[])
} }
#endif #endif
if (!g_state.picker) { if (cfg.x11) {
/* Save terminal window title */ /* Save terminal window title */
printf("\033[22;0t"); printf("\033[22;0t");
fflush(stdout); fflush(stdout);