Skip to content
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

Play and Pause Controls #22

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

duracell80
Copy link

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

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.
@duracell80
Copy link
Author

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

Updated branch to allow for play/pause to work across multiple connected monitors. And with a better kill in stop() that allows for the grepping of all players currently playing the lastfile while keeping the original kill in place in stop().

--stop in the python needs to be given the file pah or lastfile so that the shell script can grep based on video players rather than a single pid, this will stop playback on all monitors.
@SwallowYourDreams
Copy link
Contributor

SwallowYourDreams commented Oct 11, 2022

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
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants