jonniek / mpv-playlistmanager

Mpv lua script to create and manage playlists
The Unlicense
537 stars 42 forks source link

[Feature Request] Custom commands on selectfile event #119

Open tupo2 opened 1 year ago

tupo2 commented 1 year ago

Hi JoJo,

Instead of just move the selected file in the playlist, would it be possible to add an event, for example when the selected file is reached in the playlist? Example, pause playing on selected file:

KEY script-message playlistmanager onselectfile <command>
KEY script-message playlistmanager onselectfile set pause yes
jonniek commented 1 year ago

This seems very niche. It's not impossible, but also it seems kind of awkward to use the selection for this. There might be some possibility to make it a bit more general. Something like:

KEY script-message playlistmanager event cursor onload <command>
KEY script-message playlistmanager event cursor onclose <command>

Something like this maybe :thinking: So if you run the event cursor onload pause yes script message it will register the command to be run when the hovered file is loaded. This would allow setting up multiple of such events rather than locking the selection for it.

Still need to think a bit if this belongs in this script or if it's possible to make a separate one.

tupo2 commented 1 year ago

Yes, using the cursor seem a better solution than the selection. A command to lock the cursor position would be handy too, to avoid accidentally moving it.

CogentRedTester commented 1 year ago

@jonniek my custom keybind from file-browser might be interesting to you if you're thinking of going down this route. You'd probably want a much simpler system though.

jonniek commented 1 year ago

A command to lock the cursor position would be handy too, to avoid accidentally moving it.

You can change

sync_cursor_on_load
reset_cursor_on_close
reset_cursor_on_open

in settings to "no" for permanent change or at runtime with KEY change-list script-opts append playlistmanager-sync_cursor_on_load=no

tupo2 commented 1 year ago

When I say lock the cursor, I mean to not allow the cursor to move up and down.