Rafostar / gnome-shell-extension-pip-on-top

Makes "Picture-in-Picture" windows stay on top (even on Wayland session). Compatible with Firefox, but may work with few other browsers too.
GNU General Public License v2.0
53 stars 10 forks source link

[Feature Request] Add support for MPV #1

Open ykhurshid opened 2 years ago

ykhurshid commented 2 years ago

Yes, I'm one of those MPV stands. Would love a way for it to stay on top in Gnome Wayland

Rafostar commented 2 years ago

This is gonna get hacky with other applications that do not have any sort of special PiP mode (in case of mpv, --ontop option is a noop on Wayland - does nothing) unlike Firefox and Clapper.

Since there are no windowing hints set, one way with MPV is to detect it through window title:

mpv --title="Picture-in-Picture" "video.mp4"

Something like above should work with the extension, but it seems very inconvenient to me. Consider switching to Clapper media player :wink:

ykhurshid commented 2 years ago

I'll see how Clapper evolves. It would have to be exceptional to top MPV in my eyes - especially with the mountain of plugins it has accrued such as integration with sponserblock when viewing Youtube videos.

As for your solution, it wouldn't be too inconvenient at all since I can simply add a line in the mpv config line to have this be the default title for all new MPV instances. Unfortunately, it doesn't seem to actually do anything. I guess I'll see how Clapper is till the MPV devs sort out their wayland integration.

Rafostar commented 2 years ago

Make sure you have this extension installed and enabled (and also did logout/login or reboot after enabling). I have tried on both GNOME Shell 41 and older 3.36 and something like:

mpv --title="Picture-in-Picture" --geometry=720 "video.mp4"

works for me without any problems (using geometry option to make initial window size smaller).

yavko commented 2 years ago

I would like to try clapper it just doesn't support some of the web services mpv does, also is there a way to switch from and back pip with a keybind in mpv with this? Like to switch the title with a keybind?

Rafostar commented 2 years ago

I would like to try clapper it just doesn't support some of the web services mpv does

That might be simply because nobody ever requested support for them to be added.

also is there a way to switch from and back pip with a keybind in mpv with this

Someone would probably need to write some additional script for MPV to do that. MPV was not designed to support PiP. This extensions simply aims to workaround the lack of PiP Wayland protocol, but app should have some sort of PiP support first (like Firefox or Clapper), otherwise its gonna be even more hacky to get this working, not to mention inconvenient to use.

yavko commented 2 years ago

I would like to try clapper it just doesn't support some of the web services mpv does

That might be simply because nobody ever requested support for them to be added.

also is there a way to switch from and back pip with a keybind in mpv with this

Someone would probably need to write some additional script for MPV to do that. MPV was not designed to support PiP. This extensions simply aims to workaround the lack of PiP Wayland protocol, but app should have some sort of PiP support first (like Firefox or Clapper), otherwise its gonna be even more hacky to get this working, not to mention inconvenient to use.

I'd rather try clapper, I'll make a issue for the services, but does clapper support hardware encoding / decoding idk much about gstreamer.

Rafostar commented 2 years ago

@yavko

does clapper support hardware encoding / decoding idk much about gstreamer.

This is not the right place to talk about Clapper. If you have any questions for it, please use Clapper matrix channel. You can find link on its github page. Let's keep conversation here limited and related to original request about MPV support for this extension.

mgedmin commented 2 years ago

MPV has a keybinding (Alt-0) to set the window size to 50%. You can create custom keybindings to e.g. set the window size to 25%.

Personally I'd love to have a shell extension that would make non-fullscreened MPV windows always on top. Then switching between PiP and regular playback would be a single keystroke (f).

emansom commented 2 years ago

mpv doesn't really support GNOME, see docs here. Mostly a boycot of all things GNOME by the maintainer; as a consequence its window has some quirks on the Wayland session. I'd recommend using Celluloid instead and opening a issue for PiP support on their bug tracker here.

Rafostar commented 2 years ago

mpv doesn't really support GNOME, see docs here. Mostly a boycot of all things GNOME by the maintainer; (...) I'd recommend using Celluloid instead

This issue is starting to turn into support this or that player suddenly. The only player where I have control over how things work and was designed to work with PiP mode (and this extension) is Clapper. I personally cannot guarantee support for any other player.

I gave example how mpv can be started to make it work, but even that worked for some and for others did not. Same may work or not will most likely apply to any other player than Clapper.