Skip to content

Commit

Permalink
Show xterm title on option '-x'
Browse files Browse the repository at this point in the history
  • Loading branch information
jarun committed Apr 13, 2021
1 parent 2854632 commit 5bfc868
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion misc/auto-completion/fish/nnn.fish
Original file line number Diff line number Diff line change
Expand Up @@ -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 V -d 'show program version and exit'
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'
2 changes: 1 addition & 1 deletion misc/auto-completion/zsh/_nnn
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ args=(
'(-U)-U[show user and group]'
'(-V)-V[show program version and exit]'
'(-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]'
'*:filename:_files'
)
Expand Down
1 change: 1 addition & 0 deletions nnn.1
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ supports the following options:
.Fl x
show notis on selection cp, mv, rm completion
copy path to system clipboard on select
show xterm title
.Pp
.Fl h
show program help and exit
Expand Down
12 changes: 6 additions & 6 deletions src/nnn.c
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ typedef struct {
uint_t useeditor : 1; /* Use VISUAL to open text files */
uint_t reserved3 : 3;
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 cliopener : 1; /* All-CLI app opener */
uint_t waitedit : 1; /* For ops that can't be detached, used EDITOR */
Expand Down Expand Up @@ -332,7 +332,7 @@ typedef struct {
uint_t stayonsel : 1; /* Disable auto-proceed on select */
uint_t dirctx : 1; /* Show dirs in context color */
uint_t uidgid : 1; /* Show owner and group info */
uint_t reserved : 9; /* Adjust when adding/removing a field */
uint_t reserved : 9; /* Adjust when adding/removing a field */
} runstate;

/* Contexts or workspaces */
Expand Down Expand Up @@ -5914,7 +5914,7 @@ static bool browse(char *ipath, const char *session, int pkey)
setdirwatch();
}

if (!g_state.picker) {
if (cfg.x11) {
/* Set terminal window title */
r = set_tilde_in_path(path);

Expand Down Expand Up @@ -7405,7 +7405,7 @@ static void usage(void)
#endif
" -V show version\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"
"v%s\n%s\n", __func__, VERSION, GENERAL_INFO);
}
Expand Down Expand Up @@ -7512,7 +7512,7 @@ static bool set_tmp_path(void)

static void cleanup(void)
{
if (!g_state.picker) {
if (cfg.x11) {
printf("\033[23;0t"); /* reset terminal window title */
fflush(stdout);
}
Expand Down Expand Up @@ -7931,7 +7931,7 @@ int main(int argc, char *argv[])
}
#endif

if (!g_state.picker) {
if (cfg.x11) {
/* Save terminal window title */
printf("\033[22;0t");
fflush(stdout);
Expand Down

0 comments on commit 5bfc868

Please sign in to comment.