Issue reproduction steps:
1. Spawn a GUI program e.g. open a PDF file in zathura or evince.
2. Without quitting `nnn` close the terminal.
3. Notice that the application quits too.
Can be a nagging issue if someone is not using a drop-down terminal.
Fix: detach a GUI child and start it in a new session.
There are 2 aspects to this commit:
- It fixes#81: in cases where we do not wait for a spawned child we can assume
that the child is a GUI process. We detach and spawn the child in a new session.
- It changes the behaviour to @Rahi374's suggestion in PR #40 i.e. invoke the DE
opener in F_NOWAIT mode.
Use distinct (by username) tmp filename to copy file paths.
The pattern used is:
/tmp/nnncp$USER
If username is 'arun', the file name is `/tmp/nnncparun`.
The main reason to do this is to start watching the current dir for changes. In
any case, this does not harm; if there are dir entries shown on redraw that's
better than showing nothing.
Design overview:
We are introducing multiple file path copy as a mode which can be toggled using
the keybind `^Y`. `^K` works as the individual entry selector. If the user wants
to select a range, (s)he can press `^Y` on the first entry and `^Y` on the last
entry.
We subscribe to notifications, so we need a fail-proof way to detect changes in
the directory contents. For example, if a file is deleted, it becomes difficult
to get the names of all the files in a range containing that file. If the file
is on a range boundary it would lead to wrong calculations. To handle this the
right way we use CRC8 checksum of all the visible entries in the directory. The
checksum is calculated based on the file information buffer. If the CRC changes
on a redraw(), we reset the multi-select mode.
New line (`\n`) works as the delimiter between file paths. Note that you may have
to disable IFS in the `NNN_COPIER` script to show file paths separated by spaces.
The replacement keys are:
^J - toggle du mode
^Y - quit
The change is done because ^S, ^Q keybinds are lost in the following case:
- start nnn
- navigate to a different directory
- spawn a shell
- exit the shell
The issue happens only with the 'special' keybinds like ^S, ^Q, ^Z... which get
their original shell interpretation back.
So we are replacing these 2 keybinds with 2 'non-special' combinations.