-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature request: single instance mode #4954
Comments
Sadly, I'm not on Linux. I tried making an AutoHotkey macro, too, but mpv silently ignored any PostMessage "file drop" events (whereas notepad didn't). |
Linux only, it seems? |
Currently, sending |
Check - https://gist.github.com/dwgill/a66769e0edef69c04d3b . This has example of how to use |
I'd love this option. I use MPV as my default player on Windows, and need to be able to set the option so that it works when opening the file from explorer as well as from the command line. My use case is, I'll be looking through a folder of footage or renders on my edit machine. Opening each one opens up a new window, meaning I end up with dozens of videos playing back simultaneously., often hidden behind other windows. Other players like VLC or MPC* do it, how is it so hard for MPV? Not rhetorical, I'm actually interested. |
|
Probably not, but I don't see anything in this feature (most programs I use which do it I try to disable it). Let me correct myself: I really hate this feature whenever something uses it. If I start a program, I want a new program, not something retarded like affecting existing instances. Also even if it were implemented, it'd probably cause a bunch of problems we'd have to care about. |
The way I could see this feature being implemented, FWIW, is basically as an extension of Perhaps something like That way the logic for deciding how and when to behave in “single instance mode” is pretty much left to the user, and there are also clear semantics for how this is implemented on each platform, and you could even have multiple coexisting “single instance groups”. (For example, your file manager might be configured to start mpv with the socket pointing at |
I don't think quitting the other instance would cut it - it would destroy and possibly recreate the window, and reset state like the window position or audio volume. The other modes seem rather useless compared to just using a dedicated script like umpv. |
Hi, I gave implementing single instance mode for Windows a shot: https://github.com/SilverEzhik/umpvw It handles things macOS-style - opening a file will replace what you have running`. It also handles opening multiple files as a playlist. |
Most of the time I only need one mpv instance to run and i usually want the newly opened file to replace what's already running. umpv seems to only append the file to playlist and that doesnt cut it for me. I dont really use application volume, mostly set to max and the window position and size is explicitly defined in my mpv config( i either watch a video as a pop up or in fullscreen). I use a custom script to kill the currently running mpv instance and relaunch with the new video. For me the annoying thing is the second or two it takes to kill and relaunch mpv. Smplayer seems to have this feature and its based on mpv. I would love to see this implemented in mpv |
@aiamkobby commented on null:
Change |
You need to make triple-flips for just a basic functionality. This holds for practically anything in mpv. Let alone for not so basic features |
@AjvarXX If you think thats a "triple-flip", i suppose you are Not the Type of User the Player is Designed for. |
Yeah-yeah, I heard same lines from devs and I won't argue saying that you don't hear those if product is indeed ideal, open-source or not. I will let it for their own judging.
|
Another issue with using umpvw is that it doesn't switch to the mpv window, so if it's covered with other windows you have to manually switch to it. |
This (simple) solution appears to work well. Note: Linux. MPV SINGLE INSTANCE MODE
mpv-single-instance.desktop:
|
duplicate of #3811 |
This would be good to have implemented natively in mpv. I get it that usually you would want a new window to launch every time you doubleclick. But that's hardly what I've ever wanted to do for a media player. I don't want multiple songs or movies playing overlapping each other, and hate it when it does that. Scripts can easily get around it, but it's a workaround. I've been seriously considering to choose VLC or Celluloid only because they do the sane thing by default, and allow single window mode. |
This works. But I wonder if there's a command we can send so after appending to the playlist, it could switch to the playlist item we just added, so we can both build a playlist and play the video. |
I have made a piece of software, which works for Linux and Windows and does what umpv does. It effectively implements single instance mode for mpv. I have named it runmpv. To use it, make runmpv default program to play video files and specify mpv executable path in runmpv.properties (config file). You don't have to configure that under linux, if mpv executable is in your PATH. It is written in Java, but compiles to native code. You still need Windows Redistributables under windows, but as for linux, there's no additional dependencies. runmpv can work like umpv and open all videos in the same window. Also it can open different mpv windows for files from different directories. I kinda needed that )) You can take binaries from runmpv github page. I have tested runmpv on Ubuntu Xfce and on Windows 10. I would appreciate if someone tries it on their machine ))) |
I have modified @victoriastuart 's code a bit and it now looks like:
This is so that it maintain the coordinates of the previous window. Please let me know if the script can be made better. |
A much better solution given in https://askubuntu.com/a/1322227/598062
Or, you can do like:
This way instead of just loading the new file, it will add it to the playlist and then run it. That way you can go to the previous file(s). IMPORTANT: |
Last solution was great but I had a lot of issues when mixing regular files and other kind of sources/inputs. +solution could not accept mpv options as arguments. This script parses options and adds them into command remotely sent to single mpv instance running. However, there is an issue when parsing Why I did this? Because I wanted other apps such as
|
Hello, I've made a similar script that allows to run new files in an already running instance, but with the added option to specify the socket path, so you can have two single-instances for example. You can check it out here: https://github.com/Lxtharia/si-mpv |
I find it weird that there's a different a script for such a trivial opt-in feature, and it doesn't even perform the intended behavior! |
While I can understand that it might be frustrating that this is still not an included feature - there are more than enough WORKING methods that have been posted here. The one directly above your comment does work. So does umpv and most of the other ones. |
It's just the idea of using a wrapper script (which still has to be modified) to enable this feature. It's fine now. I've now started using a different approach e.g., keep-open-pause & manually paste URLs which still needed a script to enable copy-pasting) |
As in, pass the file(s) and\or URL(s) to an existing mpv instance instead of running another one. It'll be a lot faster than waiting for another instance of mpv to launch.
The text was updated successfully, but these errors were encountered: