Aanok / jftui

Jellyfin Terminal User Interface
The Unlicense
142 stars 7 forks source link

start mpv when starting jftui #15

Open 7596ff opened 4 years ago

7596ff commented 4 years ago

I like to put my mpv somewhere in my tiling workspace, so having a persistent client would help me keep it there. It would also let me maintain fullscreen on a workspace.

Aanok commented 4 years ago

I'm not sure this is possible.

jftui is designed to be as thin of a layer over a command line mpv instance as possible. You should be allowed to use your regular config files and send all normal commands, including quit as you send by default pressing the q key.

Annoyingly, when quit is received there is no way to intercept and prevent a shutdown from stock libmpv: the core will always abort and you'll have to create a new one if you want to play something again at a later time.

Right now jftui doesn't handle windows explicitly, it's all left to mpv default internals. That means that when video playback starts the window is spawned and when the core aborts the window is closed, nothing to do about it.

The solution is to manually spawn a window (in the most lightweight way, via Xcb or Xlib bindings) and point mpv to that as a rendering surface via the wid property. But I've never messed with either library and I have no idea what happens if you try to reuse the same window after an abort. It should be fine but I can't guarantee it.

It's not unreasonable or a bad idea, though. It would be nice to respect the keep-open property.