]> Sergey Matveev's repositories - nnn.git/commitdiff
Show xterm title on option '-x'
authorArun Prakash Jana <engineerarun@gmail.com>
Tue, 13 Apr 2021 10:50:28 +0000 (16:20 +0530)
committerArun Prakash Jana <engineerarun@gmail.com>
Tue, 13 Apr 2021 11:04:06 +0000 (16:34 +0530)
misc/auto-completion/fish/nnn.fish
misc/auto-completion/zsh/_nnn
nnn.1
src/nnn.c

index fdd27f899fd3a9d921b4bb50824ef48c94521375..5452d2d4eac5063ed38a1a808752fc8b1161b1cb 100644 (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 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'
index 9a33020c22b132119602e8b9e5c6ffb8252e5a20..8a865e8fd2a0a654186d42c5f02a0d21fd3be724 100644 (file)
@@ -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'
 )
diff --git a/nnn.1 b/nnn.1
index 75d748430d745573e8f8763c7a37111af3424cbc..bab27e79baadbc75374601209f706258fe1b0e46 100644 (file)
--- a/nnn.1
+++ b/nnn.1
@@ -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
index 789648709bd1edc02057e833c77e3e48bb33a009..cab29dee8e5cc826b71e13b3c1b6300cfb84a5ee 100644 (file)
--- a/src/nnn.c
+++ b/src/nnn.c
@@ -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 */
@@ -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 */
@@ -5914,7 +5914,7 @@ begin:
                setdirwatch();
        }
 
-       if (!g_state.picker) {
+       if (cfg.x11) {
                /* Set terminal window title */
                r = set_tilde_in_path(path);
 
@@ -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);
 }
@@ -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);
        }
@@ -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);