derf / feh

a fast and light image viewer
https://feh.finalrewind.org
Other
1.46k stars 158 forks source link

Feature Request: add %W format specifier for window position (to help play gifs with mpv) #719

Open aslmx opened 10 months ago

aslmx commented 10 months ago

Currently %g can be used in actions to send the current image (zoom) geometry to some external application.

As it was suggested to use external apps like mpv to view GIF files (see #308 and #502 ), I would like to suggest that feh gets the ability to launch mpv or other external gif viewers with the dimensions and position of feh, so it will perfectly overlay the feh window while a gif is being played.

I currently use the following action to launch MPV from a (still) gif in feh.

--action3 ";[Launch MPV] mpv --loop-playlist --geometry=640x480 %F"

This will open mpv at some default positioning with small geometry.

I'd love to use the full scope of --geometry to place mpv exactly over feh excerpt from mpvs manpage

--geometry=<[W[xH]][+-x+-y][/WS]>, --geometry= Adjust the initial window position or size. W and H set the window size in pixels. x and y set the window position, measured in pixels from the top-left corner of the screen to the top-left corner of the image being displayed.

So if %W would have the exact string that is needed, that would be very helpful, like this:

--action3 ";[Launch MPV] mpv --loop-playlist --geometry=%W %F"

Thanks for considering this.

derf commented 9 months ago

Could you check if b1e8bdaf5bf1c3c9c2d3ae2ba93796b6d0dddddf works for you?

There's some edge cases with wrong offsets right after starting feh in a tiling WM (and, in some cases, in fullscreen mode) that I still need to work out

aslmx commented 9 months ago

Thanks for your reply. I was on vacation. I will try to find some time to look at this commit and how to build it and then reply if it does what i need. Thanks!

aslmx commented 9 months ago

Okay, i just tried to give it a shot and build feh to see if it works. I can't. Theres to many dependencies i need to resolve. So i just checked the documents again and if %W provides

Window dimensions and offset as WxH+x+y

Then this should do!

Waiting for 3.10.2 to be in the ubuntu repos soon ;)

derf commented 9 months ago

You can already test it in 3.10.1; it's just not documented as an official feature yet as there are still some bugs in the implementation.