]> Sergey Matveev's repositories - nnn.git/commitdiff
make option NOX11: disable notis, sel to clipboard sync, xterm title
authorArun Prakash Jana <engineerarun@gmail.com>
Sat, 17 Apr 2021 07:38:34 +0000 (13:08 +0530)
committerArun Prakash Jana <engineerarun@gmail.com>
Sat, 17 Apr 2021 07:38:34 +0000 (13:08 +0530)
Makefile
misc/haiku/Makefile
src/nnn.c

index 49b4b0a951bc9b5a2a2442065ad1368e8f19a0bf..cd3fe9f6a09a5d2fecac0278cda023a598a3a3b4 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -26,6 +26,7 @@ O_BENCH := 0  # benchmark mode (stops at first user input)
 O_NOSSN := 0  # enable session support
 O_NOUG := 0  # disable user, group name in status bar
 O_CKBOARD := 0  # use checker board (stipple) in detail mode
+O_NOX11 := 0  # disable X11 integration
 
 # convert targets to flags for backwards compatibility
 ifneq ($(filter debug,$(MAKECMDGOALS)),)
@@ -105,6 +106,10 @@ ifeq ($(strip $(O_CKBOARD)),1)
        CPPFLAGS += -DCKBOARD
 endif
 
+ifeq ($(strip $(O_NOX11)),1)
+       CPPFLAGS += -DNOX11
+endif
+
 ifeq ($(shell $(PKG_CONFIG) ncursesw && echo 1),1)
        CFLAGS_CURSES ?= $(shell $(PKG_CONFIG) --cflags ncursesw)
        LDLIBS_CURSES ?= $(shell $(PKG_CONFIG) --libs   ncursesw)
index b9b0dbf473866d8debe942cede2e04e882ecf34e..4d3adc485f9f2be22734677fbc4e0e98e4fb1680 100644 (file)
@@ -24,6 +24,7 @@ O_BENCH := 0  # benchmark mode (stops at first user input)
 O_NOSSN := 0  # enable session support
 O_NOUG := 0  # disable user, group name in status bar
 O_CKBOARD := 0  # use checker board (stipple) in detail mode
+O_NOX11 := 0  # disable X11 integration
 
 # convert targets to flags for backwards compatibility
 ifneq ($(filter debug,$(MAKECMDGOALS)),)
@@ -104,6 +105,10 @@ ifeq ($(strip $(O_CKBOARD)),1)
        CPPFLAGS += -DCKBOARD
 endif
 
+ifeq ($(strip $(O_NOX11)),1)
+       CPPFLAGS += -DNOX11
+endif
+
 ifeq ($(shell $(PKG_CONFIG) ncursesw && echo 1),1)
        CFLAGS_CURSES ?= $(shell $(PKG_CONFIG) --cflags ncursesw)
        LDLIBS_CURSES ?= $(shell $(PKG_CONFIG) --libs   ncursesw)
index 16258ccc127d144ddeef3d9d509192b53aa188ee..250661f42730e0b3ea5440893f23b2d443c8cddf 100644 (file)
--- a/src/nnn.c
+++ b/src/nnn.c
@@ -5914,6 +5914,7 @@ begin:
                setdirwatch();
        }
 
+#ifndef NOX11
        if (cfg.x11) {
                /* Set terminal window title */
                r = set_tilde_in_path(path);
@@ -5924,6 +5925,7 @@ begin:
                if (r)
                        reset_tilde_in_path(path);
        }
+#endif
 
        if (g_state.selmode && lastdir[0])
                lastappendpos = selbufpos;
@@ -6579,8 +6581,10 @@ nochange:
                                        writesel(NULL, 0);
                        }
 
+#ifndef NOX11
                        if (cfg.x11)
                                plugscript(utils[UTIL_CBCP], F_NOWAIT | F_NOTRACE);
+#endif
 
                        if (!nselected)
                                unlink(selpath);
@@ -6673,8 +6677,10 @@ nochange:
                                writesel(pselbuf, selbufpos - 1); /* Truncate NULL from end */
                        }
 
+#ifndef NOX11
                        if (cfg.x11)
                                plugscript(utils[UTIL_CBCP], F_NOWAIT | F_NOTRACE);
+#endif
                        continue;
                case SEL_SELEDIT:
                        r = editselection();
@@ -6682,8 +6688,10 @@ nochange:
                                r = !r ? MSG_0_SELECTED : MSG_FAILED;
                                printwait(messages[r], &presel);
                        } else {
+#ifndef NOX11
                                if (cfg.x11)
                                        plugscript(utils[UTIL_CBCP], F_NOWAIT | F_NOTRACE);
+#endif
                                cfg.filtermode ?  presel = FILTER : statusbar(path);
                        }
                        goto nochange;
@@ -6730,9 +6738,11 @@ nochange:
                                presel = FILTER;
                        clearfilter();
 
+#ifndef NOX11
                        /* Show notification on operation complete */
                        if (cfg.x11)
                                plugscript(utils[UTIL_NTFY], F_NOWAIT | F_NOTRACE);
+#endif
 
                        if (newpath[0] && !access(newpath, F_OK))
                                xstrsncpy(lastname, xbasename(newpath), NAME_MAX+1);
@@ -7405,7 +7415,9 @@ static void usage(void)
 #endif
                " -V      show version\n"
                " -w      place HW cursor on hovered\n"
+#ifndef NOX11
                " -x      notis, sel to clipboard, xterm title\n"
+#endif
                " -h      show help\n\n"
                "v%s\n%s\n", __func__, VERSION, GENERAL_INFO);
 }
@@ -7512,10 +7524,12 @@ static bool set_tmp_path(void)
 
 static void cleanup(void)
 {
+#ifndef NOX11
        if (cfg.x11) {
                printf("\033[23;0t"); /* reset terminal window title */
                fflush(stdout);
        }
+#endif
        free(selpath);
        free(plgpath);
        free(cfgpath);
@@ -7931,11 +7945,13 @@ int main(int argc, char *argv[])
        }
 #endif
 
+#ifndef NOX11
        if (cfg.x11) {
                /* Save terminal window title */
                printf("\033[22;0t");
                fflush(stdout);
        }
+#endif
 
 #ifndef NOMOUSE
        if (!initcurses(&mask))