Closed tinus closed 6 years ago
I am not sure if this is possible. I have a similar setup and I'm using the signals (thank you, @derf!). I do something like this:
ssh host 'perl -e "kill('USR' . (pop =~ m/^n/ ? 1 : 2), qx(pgrep feh))"'
It goes to the previous image if the argument does not match /^n/, otherwise it goes to the next one.
For now, you could use the XTest extension to find the feh window and send input to it.
I'm not sure yet if I want to add such a feature to feh itself.
I also like to be able to perform 'remote control' of a displayed image from a terminal.
This USR1 USR2 signals are a good start. Here is one way of doing it...
ln -sf first_image.png /tmp/feh_1
ln -s /tmp/feh_1 /tmp/feh_2
feh /tmp/feh_1 /tmp/feh_2 &
pid=$!
Now to replace that image do this...
ln -fs new_image /tmp/feh_1
kill -s USR1 $pid
NOTE: I had to have two symbolic links (second pointing to the first) otherwise "feh" does not loop! That is it knows there is only one image, and so will do NOTHING! even though the image contents has changed!
Using two files (symbolic links) works!
I tried to use -filelist both as a FIFO pipeline, but had little success as feh will overwrite that file when it loops! Having it simply re-read that file (no write) on loop would help here.
Similarly running a slideshow (delay) on the given filelist then pausing at the end until signalled would also be a useful addition for 'remote control'. Or have it run some 'action' (call a program) after each image is displayed, or wen the timeout on the last image is reached, would allow further actions to be queued. EG: after image is read and displayed, OR end of slideshow is reached, send a signal to a control program to proceed with next step.
NOTE other programs such as ImageMgaick "display" and "animate" as well as the old "gqview" had better (but still limited) remote control features.
One remote control feature that would be GREAT and not offered by anyone else is 'user click' feedback, specifying where a user clicked in an image.
For 'montage' and 'index' modes, returning what image was picked, or running an action, (without opening that image such as provided in 'thumbnail' mode) would also work very well for script work.
"feh" is in a good position to provide these type of scripting facilities!
Hm. Right now I don't think I want scripting in feh, but I'll keep it in mind...
I was not suggesting scripting in feh. That is a whole different kettle of fish. But using feh in scripts to provide a very simple and basic user interface. That is something that would be extremely useful.
Basically all that is needed is some extra feedback methods or actions. Feh already had everything available, just some extra action options.
For example...
One thing I did find annoying was the "feh" was being 'over smart' For example not re-reading an image when only one image given, and it was signalled to go to the next image. But I did find a work-around See.. "feh" notes, in Images Remote Control. http://www.ict.griffith.edu.au/anthony/info/X/Image_Remote_Control.txt
Lovely hack, @antofthy :-)
Thanks. Are you making some use of it?
Almost did, then we discovered geeqie which is more suitable for the task. Using geeqie -r (Filename) you can start a daemonized version of the image viewer (this command must be run from a graphical environment though). Now geeqie -r -n can switch to the next image and -b goes back. -q causes program exit. Still, this only seems to work if you can run this initial command from GUI (not from SSH). Luckily we do have this possibility. If that's not possible, I'd fallback to your hack.
Shame its not documented in the man page! Makes it very hard to learn what you can do with a application, which is why I missed it. I would probably also include the "-t" flag to hide the tools. Hmmm...
My final summary, after having look...
Geeqie provides some controls designed with simple slideshows in mind rather than more complex scripted interfaces.
The display can be set to/from fullscreen mode, non-fullscreen mode can not be set to image size or even to some command defined geometry (such as in display setup).
The window is also automatically brought to the top of the display stack when a remote command is given (not good, unless full screen, other tools can do this if it is wanted).
This slideshow remote control is a lot simpler than "feh", however "feh" also provides some initial window geometry control, and minor feedback capability.
(now uploaded to my Image Remote Control doc)
You can still run it via SSH.
X displays need two things: the DISPLAY saying where to display and Permission (typicaly via xauth and XAUTHORITY).
If you want it in the display of the machine you run the command on set DISPLAY to ":0" and locate the xauth file. May need root permissions if you did not start the display yourself.
If you want it on the DISPLAY you launched the ssh command on, the use ssh -x to ask it to set up the DISPLAY link. The remote machine daemon needs to also accept the X connection, but ssh will tell you if that happens.
fwiw, receiving commands from the terminal that started feh is supported as of feh 2.20
Thanks Danial. saw the update when you closed the feh report. I'll have to investigate further.
On Thu, Mar 1, 2018 at 4:07 AM, Daniel Friesel notifications@github.com wrote:
fwiw, receiving commands from the terminal that started feh is supported as of feh 2.20
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/derf/feh/issues/67#issuecomment-369325944, or mute the thread https://github.com/notifications/unsubscribe-auth/ABKIwFbMGpqwzXBq0d5IWD3rxJx_cRlAks5tZZORgaJpZM4G1mwC .
I am running feh on a remote machine by starting it from a ssh terminal. I expected to be able to use the shortcuts in the terminal just as I would when feh is running localy. Feh does output to the terminal (e.g. when a filetype isn't supported) but it doesn't react to input from the terminal. Apparently I can use SIGUSR1 and SIGUSR2 to go back and forth between images but it would be much easier if feh would just react to keyboard input from the terminal.