ghostlexly / gpu-video-wallpaper

Use your GPU for rendering low CPU usage video animated wallpaper.
MIT License
165 stars 12 forks source link

Play and Pause Controls #22

Open duracell80 opened 1 year ago

duracell80 commented 1 year ago

Adds the ability to use a socket to mpv to control playback. Such as pause and play. Fixes location of xwinwrap as being referenced in users local bin directory.

Screenshot

duracell80 commented 1 year ago

This would allow for keyboard shortcuts or other scripts to pause the video playback. For example if the desktop is no longer in view or has lost focus it would be possible to reduce CPU and increase battery by running:

video-wallpaper.sh --pause

SwallowYourDreams commented 1 year ago

Hey there, thanks for your work - I think the ability to pause playback (in the best of cases automagically when the desktop is hidden) is a neat feature to add! I've got several questions about the implementation though:

  1. On top of adding the functionality to video-wallpaper.sh you've added a pause/play button + functionality to the UI file and python script, which I don't feel is really necessary as the user gains little to no benefit over just stopping playback; it just bloats the UI in my view.
  2. You've added a variable called "binaryDir" to video-wallpaper.py as well as video-wallpaper.sh, claiming in the readme.md that this is now the place that holds the xwinwrap binary. The variable, however, is redundant, as installer.sh already places everything into that folder (including xwinwrap); video-wallpaper.py and .sh in turn read this directory from the path of the running script and store it in the variable "scriptDir". With this change applied, we've got two variables containing the exact same value.

Feel free to correct me if I misunderstood your changes. I'd be happy to include your changes into my fork once the above two points have been settled.

duracell80 commented 1 year ago

Hey excellent point about the UI. To be fair I would have liked to add a toggle button instead to keep the clutter down, but figured the two was a good enough addition. They aren't needed in the UI as you say as I can see that really being used to stop and change and start a new video. Although I think useful as a backup to forgetting a keybinding. Could I bind --pause to a keyboard shortcut? Yeah, do I trust myself to remember what it was when I get a zoom call and have to quickly pause the background?

The xwinwrap missing dependency was causing some issues at least for me on Linux Mint, so that seemed to be more robust pointing directly at the user bin and is a bit cleaner to read source code wise. Again though that's not a necessary addition to carry the play/pause.

Thanks for considering the --pause --play switches. It certainly feels nicer to pause and keep the scene in place; since when I stop the video I drop back to a jpg background and opens the possibility of other scripts say a battery monitor being able to swoop in and pause automatically.