diff options
author | Arun Prakash Jana <engineerarun@gmail.com> | 2018-03-30 21:23:28 +0530 |
---|---|---|
committer | Arun Prakash Jana <engineerarun@gmail.com> | 2018-03-30 21:23:28 +0530 |
commit | 3a515585d1743e197918efd0031856b545227576 (patch) | |
tree | b5f274b95fb84b2c25bc5f4e53d80e022bbecc0d | |
parent | 1e1708c2ec1b9a10d5b652d549ead5b0e2d7d357 (diff) | |
download | nnn-3a515585d1743e197918efd0031856b545227576.tar.gz |
Support screen locking on Linux
-rw-r--r-- | README.md | 1 | ||||
-rw-r--r-- | nnn.1 | 2 | ||||
-rw-r--r-- | nnn.c | 8 | ||||
-rw-r--r-- | nnn.h | 11 |
4 files changed, 20 insertions, 2 deletions
@@ -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 @@ -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 @@ -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"; @@ -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, "", "" }, |