ytfzf icon indicating copy to clipboard operation
ytfzf copied to clipboard

[Feature request]: re use mpv instance

Open citosid opened this issue 2 years ago • 3 comments

Background

  • [x] I have checked ytfzf(1) and ytfzf(5) or the wiki before creating this.

Problem

Every time ytfzf is run, a new instance of the player is opened

Feature

Running ytfzf from the command line will open a new window of mpv every time. However, it is possible to configure mpv to use sockets and send a command to load the new url instead of opening a new instance

echo "{ \"command\": [\"loadfile\", \"$1\"] }" | socat - "/tmp/mpv-socket"

Alternative solutions to problem?

Kill the current one and open it again? I use i3 (specifically regolith) and have the mpv player configured to be sticky and small so it always shows in my desktop:

image

So it would always span a new window and will lost that configuration... as you can see in the image, I tried with a local file and it works. Will try to do a MR for this feature, but not sure if there is any downside to do it like that

citosid avatar Feb 01 '23 20:02 citosid

If you want to work on a pull request, i'd recommend modifying the mpvq addon to work across all instances of ytfzf.

Or you could just make a new addon that basically does the same thing as mpvq but works on all instances.

I probably wouldn't merge this feature into the main script.

Euro20179 avatar Feb 01 '23 21:02 Euro20179

Thanks for the quick reply @Euro20179 ! You beat me to it lol.

Could you at least review the code I have to see if you see any problem? I will look into either modifying mpvq or adding a new one.

citosid avatar Feb 01 '23 21:02 citosid