Refresh dirs on disruptive chnages, update sxiv plugin to browse and rename

This commit is contained in:
Arun Prakash Jana 2019-11-19 21:01:59 +05:30
parent 97e16364bb
commit 9729b1f5a6
No known key found for this signature in database
GPG key ID: A75979F35C080412
3 changed files with 22 additions and 4 deletions

View file

@ -47,7 +47,7 @@ Plugins extend the capabilities of `nnn`. They are _executable_ scripts (or bina
| ringtone | sh | date, ffmpeg | Create a variable bitrate mp3 ringtone from file | | ringtone | sh | date, ffmpeg | Create a variable bitrate mp3 ringtone from file |
| splitjoin | sh | split, cat | Split file or join selection | | splitjoin | sh | split, cat | Split file or join selection |
| suedit | sh | sudoedit/sudo/doas | Edit file using superuser permissions | | suedit | sh | sudoedit/sudo/doas | Edit file using superuser permissions |
| sxiv | sh | sxiv | View images in dir, set wallpaper, copy path ([config](https://wiki.archlinux.org/index.php/Sxiv#Assigning_keyboard_shortcuts))| | sxiv | sh | sxiv | Browse images in dir, set wallpaper, copy path ([config](https://wiki.archlinux.org/index.php/Sxiv#Assigning_keyboard_shortcuts)), [rename](https://github.com/jarun/nnn/wiki/Basic-use-cases#browse-rename-images)|
| thumb | sh | [lsix](https://github.com/hackerb9/lsix) | View thumbnail of an image or dir of images | | thumb | sh | [lsix](https://github.com/hackerb9/lsix) | View thumbnail of an image or dir of images |
| transfer | sh | curl | Upload file to transfer.sh | | transfer | sh | curl | Upload file to transfer.sh |
| treeview | sh | tree | Informative tree output in `$EDITOR` | | treeview | sh | tree | Informative tree output in `$EDITOR` |

View file

@ -1,8 +1,20 @@
#!/usr/bin/env sh #!/usr/bin/env sh
# Description: Open images in current directory in sxiv # Description: Open images in hovered directory and thumbnails
# open hovered image in sxiv and browse other images in the directory
# #
# Shell: POSIX compliant # Shell: POSIX compliant
# Author: Arun Prakash Jana # Author: Arun Prakash Jana
sxiv -q * >/dev/null 2>&1 & if command -v sxiv >/dev/null 2>&1; then
if ! [ -z "$1" ]; then
if [ -f "$1" ]; then
sxiv -q "$PWD"
elif [ -d "$1" ] || [ -h "$1" ]; then
sxiv -qt "$1"
fi
fi
else
echo "sxiv missing"
read dummy
fi

View file

@ -4591,6 +4591,8 @@ nochange:
case SEL_RUNPAGE: // fallthrough case SEL_RUNPAGE: // fallthrough
case SEL_LOCK: case SEL_LOCK:
{ {
bool refresh = FALSE;
if (ndents) if (ndents)
mkpath(path, dents[cur].name, newpath); mkpath(path, dents[cur].name, newpath);
else if (sel == SEL_ARCHIVELS || sel == SEL_EXTRACT else if (sel == SEL_ARCHIVELS || sel == SEL_EXTRACT
@ -4600,11 +4602,14 @@ nochange:
switch (sel) { switch (sel) {
case SEL_ARCHIVELS: case SEL_ARCHIVELS:
handle_archive(newpath, path, 'l'); handle_archive(newpath, path, 'l');
refresh = TRUE;
break; break;
case SEL_EXTRACT: case SEL_EXTRACT:
handle_archive(newpath, path, 'x'); handle_archive(newpath, path, 'x');
refresh = TRUE;
break; break;
case SEL_REDRAW: case SEL_REDRAW:
refresh = TRUE;
break; break;
case SEL_RENAMEMUL: case SEL_RENAMEMUL:
endselection(); endselection();
@ -4613,6 +4618,7 @@ nochange:
printwait(messages[OPERATION_FAILED], &presel); printwait(messages[OPERATION_FAILED], &presel);
goto nochange; goto nochange;
} }
refresh = TRUE;
break; break;
case SEL_HELP: case SEL_HELP:
show_help(path); show_help(path);
@ -4631,7 +4637,7 @@ nochange:
/* In case of successful operation, reload contents */ /* In case of successful operation, reload contents */
/* Continue in navigate-as-you-type mode, if enabled */ /* Continue in navigate-as-you-type mode, if enabled */
if (cfg.filtermode && sel != SEL_REDRAW) if (cfg.filtermode && !refresh)
break; break;
/* Save current */ /* Save current */