make option NOX11: disable notis, sel to clipboard sync, xterm title

This commit is contained in:
Arun Prakash Jana 2021-04-17 13:08:34 +05:30
parent 2b94c29e1d
commit 25157592df
No known key found for this signature in database
GPG key ID: A75979F35C080412
3 changed files with 26 additions and 0 deletions

View file

@ -26,6 +26,7 @@ O_BENCH := 0 # benchmark mode (stops at first user input)
O_NOSSN := 0 # enable session support O_NOSSN := 0 # enable session support
O_NOUG := 0 # disable user, group name in status bar O_NOUG := 0 # disable user, group name in status bar
O_CKBOARD := 0 # use checker board (stipple) in detail mode O_CKBOARD := 0 # use checker board (stipple) in detail mode
O_NOX11 := 0 # disable X11 integration
# convert targets to flags for backwards compatibility # convert targets to flags for backwards compatibility
ifneq ($(filter debug,$(MAKECMDGOALS)),) ifneq ($(filter debug,$(MAKECMDGOALS)),)
@ -105,6 +106,10 @@ ifeq ($(strip $(O_CKBOARD)),1)
CPPFLAGS += -DCKBOARD CPPFLAGS += -DCKBOARD
endif endif
ifeq ($(strip $(O_NOX11)),1)
CPPFLAGS += -DNOX11
endif
ifeq ($(shell $(PKG_CONFIG) ncursesw && echo 1),1) ifeq ($(shell $(PKG_CONFIG) ncursesw && echo 1),1)
CFLAGS_CURSES ?= $(shell $(PKG_CONFIG) --cflags ncursesw) CFLAGS_CURSES ?= $(shell $(PKG_CONFIG) --cflags ncursesw)
LDLIBS_CURSES ?= $(shell $(PKG_CONFIG) --libs ncursesw) LDLIBS_CURSES ?= $(shell $(PKG_CONFIG) --libs ncursesw)

View file

@ -24,6 +24,7 @@ O_BENCH := 0 # benchmark mode (stops at first user input)
O_NOSSN := 0 # enable session support O_NOSSN := 0 # enable session support
O_NOUG := 0 # disable user, group name in status bar O_NOUG := 0 # disable user, group name in status bar
O_CKBOARD := 0 # use checker board (stipple) in detail mode O_CKBOARD := 0 # use checker board (stipple) in detail mode
O_NOX11 := 0 # disable X11 integration
# convert targets to flags for backwards compatibility # convert targets to flags for backwards compatibility
ifneq ($(filter debug,$(MAKECMDGOALS)),) ifneq ($(filter debug,$(MAKECMDGOALS)),)
@ -104,6 +105,10 @@ ifeq ($(strip $(O_CKBOARD)),1)
CPPFLAGS += -DCKBOARD CPPFLAGS += -DCKBOARD
endif endif
ifeq ($(strip $(O_NOX11)),1)
CPPFLAGS += -DNOX11
endif
ifeq ($(shell $(PKG_CONFIG) ncursesw && echo 1),1) ifeq ($(shell $(PKG_CONFIG) ncursesw && echo 1),1)
CFLAGS_CURSES ?= $(shell $(PKG_CONFIG) --cflags ncursesw) CFLAGS_CURSES ?= $(shell $(PKG_CONFIG) --cflags ncursesw)
LDLIBS_CURSES ?= $(shell $(PKG_CONFIG) --libs ncursesw) LDLIBS_CURSES ?= $(shell $(PKG_CONFIG) --libs ncursesw)

View file

@ -5914,6 +5914,7 @@ begin:
setdirwatch(); setdirwatch();
} }
#ifndef NOX11
if (cfg.x11) { if (cfg.x11) {
/* Set terminal window title */ /* Set terminal window title */
r = set_tilde_in_path(path); r = set_tilde_in_path(path);
@ -5924,6 +5925,7 @@ begin:
if (r) if (r)
reset_tilde_in_path(path); reset_tilde_in_path(path);
} }
#endif
if (g_state.selmode && lastdir[0]) if (g_state.selmode && lastdir[0])
lastappendpos = selbufpos; lastappendpos = selbufpos;
@ -6579,8 +6581,10 @@ nochange:
writesel(NULL, 0); writesel(NULL, 0);
} }
#ifndef NOX11
if (cfg.x11) if (cfg.x11)
plugscript(utils[UTIL_CBCP], F_NOWAIT | F_NOTRACE); plugscript(utils[UTIL_CBCP], F_NOWAIT | F_NOTRACE);
#endif
if (!nselected) if (!nselected)
unlink(selpath); unlink(selpath);
@ -6673,8 +6677,10 @@ nochange:
writesel(pselbuf, selbufpos - 1); /* Truncate NULL from end */ writesel(pselbuf, selbufpos - 1); /* Truncate NULL from end */
} }
#ifndef NOX11
if (cfg.x11) if (cfg.x11)
plugscript(utils[UTIL_CBCP], F_NOWAIT | F_NOTRACE); plugscript(utils[UTIL_CBCP], F_NOWAIT | F_NOTRACE);
#endif
continue; continue;
case SEL_SELEDIT: case SEL_SELEDIT:
r = editselection(); r = editselection();
@ -6682,8 +6688,10 @@ nochange:
r = !r ? MSG_0_SELECTED : MSG_FAILED; r = !r ? MSG_0_SELECTED : MSG_FAILED;
printwait(messages[r], &presel); printwait(messages[r], &presel);
} else { } else {
#ifndef NOX11
if (cfg.x11) if (cfg.x11)
plugscript(utils[UTIL_CBCP], F_NOWAIT | F_NOTRACE); plugscript(utils[UTIL_CBCP], F_NOWAIT | F_NOTRACE);
#endif
cfg.filtermode ? presel = FILTER : statusbar(path); cfg.filtermode ? presel = FILTER : statusbar(path);
} }
goto nochange; goto nochange;
@ -6730,9 +6738,11 @@ nochange:
presel = FILTER; presel = FILTER;
clearfilter(); clearfilter();
#ifndef NOX11
/* Show notification on operation complete */ /* Show notification on operation complete */
if (cfg.x11) if (cfg.x11)
plugscript(utils[UTIL_NTFY], F_NOWAIT | F_NOTRACE); plugscript(utils[UTIL_NTFY], F_NOWAIT | F_NOTRACE);
#endif
if (newpath[0] && !access(newpath, F_OK)) if (newpath[0] && !access(newpath, F_OK))
xstrsncpy(lastname, xbasename(newpath), NAME_MAX+1); xstrsncpy(lastname, xbasename(newpath), NAME_MAX+1);
@ -7405,7 +7415,9 @@ 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"
#ifndef NOX11
" -x notis, sel to clipboard, xterm title\n" " -x notis, sel to clipboard, xterm title\n"
#endif
" -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,10 +7524,12 @@ static bool set_tmp_path(void)
static void cleanup(void) static void cleanup(void)
{ {
#ifndef NOX11
if (cfg.x11) { if (cfg.x11) {
printf("\033[23;0t"); /* reset terminal window title */ printf("\033[23;0t"); /* reset terminal window title */
fflush(stdout); fflush(stdout);
} }
#endif
free(selpath); free(selpath);
free(plgpath); free(plgpath);
free(cfgpath); free(cfgpath);
@ -7931,11 +7945,13 @@ int main(int argc, char *argv[])
} }
#endif #endif
#ifndef NOX11
if (cfg.x11) { if (cfg.x11) {
/* Save terminal window title */ /* Save terminal window title */
printf("\033[22;0t"); printf("\033[22;0t");
fflush(stdout); fflush(stdout);
} }
#endif
#ifndef NOMOUSE #ifndef NOMOUSE
if (!initcurses(&mask)) if (!initcurses(&mask))