pqiv
pqiv copied to clipboard
Open new images in an existing instance
This is probably more of a feature request than a defect. Is it possible to open a new image in an existing instance of pqiv? I am trying to achieve a workflow where:
- open an image in
pqivin the background - open a new image in the above instance of
pqivinstead of a new instance/window
You can do that by adding a wrapper script and using --actions-from-stdin if you need a quick workaround.
Can you please share the steps?
I added the following in a wrapper:
#!/usr/bin/env sh
pqiv --actions-from-stdin
Now if I start the script in the bg it quits immediately.
I'm thinking something like
#!/bin/sh
#
mkfifo _pqiv_fifo
cleanup() { rm _pqiv_fifo; }
trap cleanup EXIT
(while true; do cat _pqiv_fifo; done) | pqiv -r
for the server and for the client
#!/bin/sh
#
for FN in "$@"; do
echo "$FN" > _pqiv_fifo
done
Combine this into a single script that automatically detects whether to fork a server and you've got your single-session wrapper :)
Thanks!
I am looking for a simple way to integrate pqiv and nnn in such a way that one can traverse through image files in nnn and those could be viewed in pqiv.
Thinking of the following flow:
- user presses a keybind in
nnnto startpqivin listening mode (nnncallspqivwith a specific option to do this) - when he traverses through the files/or presses
Enter,nnncallspqivwith a specific option and the file name so the file is opened in the existing instance ofpqiv
The integration should be transparent to the user and without the need of any additional script. To be more specific, I was looking for an image viewer with a single instance mode so newly opened files are opened in the current instance of the viewer.
I am not sure how hard it is to achieve this. But if it works that would be great.
If nnn will drive this, why not just have it own the process and control it? ranger does it this way.
I have an advanced version of ranger's integration at work which does exactly what you want, I'll share the code next week, you should be able to copy the ideas quite easily.
sure!