Open guidocella opened 1 week ago
Download the artifacts for this pull request:
Can we add default keybindings for those commands? Else it will become dead code.
Sure I was trying not to burden the original proposal with breaking changes. What about:
Move cycle pause to MBTN_LEFT drag-to-pan on MBTN_RIGHT align-to-cursor on MBTN_MID cursor-centric-zoom on Ctrl+wheel Rebind Alt+Arrows to osd-relative-pan ?
Unfortunately we can't easily set different default key bindings for images if we're set on deprecating input sections.
Touch input in
cursor-centric-zoom
is untested.
I'm using a touchpad but not sure how exactly I'm supposed to keybind it
Ctrl+MBTN_LEFT script-binding drag-to-pan. (this one works) tried this and invalid command Ctrl+Alt+WHEEL_UP cursor-centric-zoom same as this one Ctrl+Alt+WHEEL_UP cursor-centric-zoom add video-zoom 0.05 Ctrl+UP align-to-cursor (not sure but says invalid command)
thanks for the help..yes the centric-cursor-zoom works great on touchpad. Thanks for adding these...gonna use mpv as main image viewer on mac. These are great additions.
Ctrl+Wheel_Down add video-zoom -0.05 #! [Video/Image] > [Scale] > Zoom Out (scroll down) Ctrl+Wheel_Up add video-zoom 0.05 #! [Video/Image] > [Scale] > Zoom In (scroll up) Alt+Wheel_Down script-message cursor-centric-zoom -0.05 #! [Video/Image] > [Scale] > Zoom Out near cursor Alt+Wheel_Up script-message cursor-centric-zoom 0.05 #! [Video/Image] > [Scale] > Zoom In near cursor Alt+MBTN_LEFT script-binding align-to-cursor #! [Video/Image] > [Scale] > Pan aligned to cursor (while zoomed in) Ctrl+MBTN_LEFT script-binding drag-to-pan #! [Video/Image] > [Scale] > Drag to Pan (while zoomed in)
Yeah I know it works on a touchpad, by untested touch input I meant devices like tables which populate the touch-pos
property (or at least I assume touch-pos
is not supposed to work with touchpads).
EDIT: I was trying a touchpad on Xorg whose backend doesn't implement touch-pos, it should work on Wayland.
Updated as nanahi requested in https://github.com/mpv-player/mpv/pull/15316. Also, my point in https://github.com/mpv-player/mpv/pull/15316#issuecomment-2481457532 of cursor-centric-zoom not needing multiple amounts was moot since you need a negative amount to zoom out (unless you add different script-bindings to zoom in and out).
But unfortunately, beyond the bindings being so long that they get cropped in the stats page, they just don't work, because the script-binding runs before change-list updates the script-opt. So something like repeatable no-osd change-list script-opts append positioning-pan_amount=-0.2; script-binding positioning/pan-x
will use the last pan_amount on the first trigger, and only use -0.2 from the second trigger onwards.
This should be put off until dragging deadzone is supported on macOS. It wasn't implemented in that PR.
@na-na-hi did you mean this https://github.com/mpv-player/mpv/pull/13582 one?
@na-na-hi did you mean this #13582 one?
Yes. It makes dragging send a VOCTRL to the VO to signal beginning of dragging, so it has no effect if the VO doesn't handle the VOCTRL.
okay, i will look into it. sry that PR kinda went by me.
How do you intend to support key bindings with different pan and zoom amounts without making them commands? repeatable script-message-to positioning set-pan-amount -0.2; script-binding positioning/pan-x
works, but it is a hack which may break if ever support holding down multiple keys to pan diagonally. I think script-binding should just support variable arguments like script-message, else it will always be inferior to commands. It can pass a JSON array of user arguments, mp.input already works this way. (Supporting no-osd would also be nice if feasible).
How do you intend to support key bindings with different pan and zoom amounts without making them commands?
The easiest way would be making fast and slow pan parameters as script options.
I think script-binding should just support variable arguments like script-message, else it will always be inferior to commands. It can pass a JSON array of user arguments, mp.input already works this way.
The problem is that script-binding
internally sends the key information as script-message
, so any arguments added to script-binding
need to be also included in the message which already has some parameters. At best it can only support one argument, because if multiple parameters are supported, we can never add more arguments for the key information again without breaking compatibility.
The easiest way would be making fast and slow pan parameters as script options.
As I just wrote changing script-opts within the binding doesn't work, so we would need 8 script bindings + 2 script-opts just to pan: pan-up, pan-right, pan-down, pan-left, pan-up-slow, pan-right-slow, pan-down-slow, pan-left-slow. And what about when someone wants a 3rd speed? How is this better than 1 command?
The problem is that
script-binding
internally sends the key information asscript-message
, so any arguments added toscript-binding
need to be also included in the message which already has some parameters. At best it can only support one argument, because if multiple parameters are supported, we can never add more arguments for the key information again without breaking compatibility.
Hence the JSON array, you send all user arguments as 1 argument to script message. I already do this in console.lua to send 0 1 or 2 arguments to input.lua, and I can add more arguments whenever is necessary.
I have added support for custom argument for script-binding
in https://github.com/mpv-player/mpv/pull/15316. This should make it possible to customize amount in input.conf
.
This works great now by depending on #15316. You can easily fork the script and there is no need to add commands to the core, and other scripts can also benefit from the new scale and arg arguments to script-binding.
Once macOS supports the dragging deadzone we can bind drag-to-pan to MBTN_RIGHT by default, but there is no hurry.
This script provides script messages and bindings to pan videos and images, making mpv a better image viewer out of the box.
I've had this script for 3 years in my image config so why not upstream it to view images better out of the box. Credits to occivink for the original ideas of the bindings.
I also have a mouse gesture and a oneshot double page mode in my script but those may not be worth upstreaming.
For the reasoning behind the
suppress_osd
naming, see https://github.com/mpv-player/mpv/pull/9051#issuecomment-887290791Touch input in
cursor-centric-zoom
is untested.For negative zoom, I think we need a global option like
--auto-recenter-video
(implemented invo_get_src_dst_rects()
?) to reset video-align to 0 when the image is smaller than the OSD, so that it also applies when changing video-zoom/panscan/video-unscaled/video-aspect-override/video-scale/changing file. Then positioning.lua should do nothing when that option is true and the image is smaller than the OSD. In my config, I use