aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Arun Prakash Jana <engineerarun@gmail.com>2018-03-30 21:23:28 +0530
committerGravatar Arun Prakash Jana <engineerarun@gmail.com>2018-03-30 21:23:28 +0530
commit3a515585d1743e197918efd0031856b545227576 (patch)
treeb5f274b95fb84b2c25bc5f4e53d80e022bbecc0d
parent1e1708c2ec1b9a10d5b652d549ead5b0e2d7d357 (diff)
downloadnnn-3a515585d1743e197918efd0031856b545227576.tar.gz
Support screen locking on Linux
-rw-r--r--README.md1
-rw-r--r--nnn.12
-rw-r--r--nnn.c8
-rw-r--r--nnn.h11
4 files changed, 20 insertions, 2 deletions
diff --git a/README.md b/README.md
index a6170f4..fc35517 100644
--- a/README.md
+++ b/README.md
@@ -242,6 +242,7 @@ optional arguments:
^Y | Toggle multi-copy mode
^T | Toggle path quote
^L | Redraw, clear prompt
+ L | Lock terminal (on Linux)
? | Help, settings
Q, ^G | Quit and cd
q, ^X | Quit
diff --git a/nnn.1 b/nnn.1
index ab10d1f..0d00d10 100644
--- a/nnn.1
+++ b/nnn.1
@@ -112,6 +112,8 @@ Toggle multiple file path copy mode
Toggle path quote
.It Ic ^L
Force a redraw, clear rename or filter prompt
+.It Ic L
+Lock terminal (Linux only)
.It Ic \&?
Toggle help and settings screen
.It Ic Q, ^G
diff --git a/nnn.c b/nnn.c
index be830fe..c6b3e19 100644
--- a/nnn.c
+++ b/nnn.c
@@ -1968,6 +1968,9 @@ show_help(char *path)
"d^Y | Toggle multi-copy mode\n"
"d^T | Toggle path quote\n"
"d^L | Redraw, clear prompt\n"
+#ifdef __linux__
+ "eL | Lock terminal\n"
+#endif
"e? | Help, settings\n"
"aQ, ^G | Quit and cd\n"
"aq, ^X | Quit\n\n");
@@ -3208,6 +3211,11 @@ nochange:
run = xgetenv(env, run);
spawn(run, dents[cur].name, NULL, path, F_NORMAL);
break;
+#ifdef __linux__
+ case SEL_LOCK:
+ spawn(player, "", "screensaver", NULL, F_NORMAL | F_SIGINT);
+ break;
+#endif
case SEL_CDQUIT:
{
char *tmpfile = "/tmp/nnn";
diff --git a/nnn.h b/nnn.h
index a3e7967..680200f 100644
--- a/nnn.h
+++ b/nnn.h
@@ -44,6 +44,9 @@ enum action {
SEL_RUN,
SEL_RUNSCRIPT,
SEL_RUNARG,
+#ifdef __linux__
+ SEL_LOCK,
+#endif
SEL_CDQUIT,
SEL_QUIT,
};
@@ -135,9 +138,9 @@ static struct key bindings[] = {
/* Open dir in desktop file manager */
{ 'o', SEL_DFB, "", "" },
/* List archive */
- { 'F', SEL_LIST, "-l", "" },
+ { 'F', SEL_LIST, "-l", "" },
/* Extract archive */
- { CONTROL('F'), SEL_EXTRACT, "-x", "" },
+ { CONTROL('F'), SEL_EXTRACT, "-x", "" },
/* Toggle sort by size */
{ 's', SEL_FSIZE, "", "" },
/* Sort by total block count including dir contents */
@@ -173,6 +176,10 @@ static struct key bindings[] = {
/* Run command with argument */
{ 'e', SEL_RUNARG, "vi", "EDITOR" },
{ 'p', SEL_RUNARG, "less", "PAGER" },
+#ifdef __linux__
+ /* Lock screen */
+ { 'L', SEL_LOCK, "", "" },
+#endif
/* Change dir on quit */
{ 'Q', SEL_CDQUIT, "", "" },
{ CONTROL('G'), SEL_CDQUIT, "", "" },