GhostNaN / mpvpaper

A video wallpaper program for wlroots based wayland compositors.
GNU General Public License v3.0
805 stars 26 forks source link

--auto-pause doesn't take effect? #12

Closed tmpm697 closed 3 years ago

tmpm697 commented 3 years ago

I use sway and use tabbed window mode, I had:

exec  mpvpaper --auto-pause -o "no-audio --loop-playlist shuffle" DP-2 /path/to/mp4/video

when I have window in fullscreen mode, I still observe high cpu usage of mpvpaper, so I guess it's not paused, how to check if it's paused and how to make pause work.

As I only want when I can't see wallpaper as other windows took all screen spaces, it's paused/stopped and unpaused/unstopped when there's spaces showing wallpaper. (I don't understand when "Automagically pause mpv when the wallpaper is hidden")

GhostNaN commented 3 years ago

I said what "hidden" means in: https://github.com/GhostNaN/mpvpaper/releases/tag/1.1 Under "Notes" and "Limitations of automagic".

Run mpvpaper in a terminal with the -v option, then make the terminal fullscreen. After a few seconds it should say "Pausing because mpvpaper is hidden" and mpv in the terminal should say it's in a paused state. Play something with audio to be more obvious.

Also check --auto-stop as well for me and use a resource monitor like htop, fullscreen it and see if mpvpaper uses less RAM.

tmpm697 commented 3 years ago

Yes, it's paused if fullscreen mode, but in my setup, I have default all window tabbed and no border ..etc, then it looks like fullscreen.

I need that as I need to focus left/right between windows.

Can mpvpaper aware of screen space that took up by other windows, so it only run if not all space took up?

OR have option only play if no window in current workspace at all?

GhostNaN commented 3 years ago

Unfortunately no... that's why it's called "Limitations of automagic". It's up to the compositor (in this case Sway) to decide if it's worth drawing via a surface frame callback. If you care for even more details: https://wayland-book.com/surfaces-in-depth/frame-callbacks.html

I do not know any other way of detecting if a window is blocking the view of mpvpaper. Without resorting to some really nasty hacks with sway ipc (which is out of scope of this project anyway) or something else. Sorry.

tmpm697 commented 3 years ago

@GhostNaN : Actually how to have like: if have windows in tabbed mode then paused? Is that possible?

GhostNaN commented 3 years ago

mpvpaper only communicates with wlroots. It has no way of knowing anything what Sway is doing and how it manages it's windows.

But if you're desperate for that kind of option, you might be able to implement it your self with a keybinding or window rule and a mpv socket. Like I mentioned in the README under the "Controlling" section.

Then you could make a keybind in the conf like so: bindsym $Ctrl+Alt+x exec echo 'cycle pause' | socat - /tmp/mpv-socket

I'm not going to go into specifics for your use case. It's up to you to implement how you like. Good luck, have fun!

tmpm697 commented 3 years ago

Yes, I already have idea how this can be achieved. Thanks.