Updated Advanced use cases (markdown)

luukvbaal 2021-11-04 12:04:08 +01:00
parent 115d7b148a
commit a652ca3ad6

@ -122,6 +122,31 @@ StartupWMClass=NNN
`--class "NNN"` is used to group all `nnn` instances together and `StartupWMClass=NNN` to tell launcher which windows should be associated with this icon.
### Browser Integration
#### Chromium
To use `nnn` as the file picker dialog for chromium browsers, create a script `kdialog` in your path:
```sh
#!/bin/sh
while :; do case $1 in
--getsavefilename) file="$2" break ;;
--*) shift ;;
*) break ;;
esac done
file="${file##/*/}"
st -c picker sh -c "nnn -S -s picker -p - | awk '{ print system(\"[ -d \" \$0 \" ]\") ? \$0: \$0\"/${file##/*/}\" }' > /proc/$$/fd/1"
```
Then create a browser wrapper that launches your browser with `XDG_CURRENT_DESKTOP=KDE`:
```sh
#!/bin/sh
XDG_CURRENT_DESKTOP=KDE <browser binary> "$@"
```
This will cause chromium to look for `kdialog` to open files, make sure the `kdialog` script comes in your `PATH` before the `kdialog` package binary if you have this installed.
## Launch `nnn` with a keyboard shortcut
### On a Desktop Environment (KDE, GNOME, XFCE)
@ -314,4 +339,4 @@ list of supported commands:
help on a particular command:
lftp :~> help put
lftp :~> help put