Francesco149 / weebp

free and open-source wallpaper engine, set any window as your wallpaper
The Unlicense
549 stars 60 forks source link

when running another mpv instance #14

Open phanirithvij opened 4 years ago

phanirithvij commented 4 years ago

When running another mpv instance before starting

wp run mpv ....

wp will push the existing mpv into the background instead of opening the new one in the background.

A video showing what I mean.

phanirithvij commented 4 years ago

contents of videowalls.bat

wp run mpv ^
--player-operation-mode=pseudo-gui ^
--force-window=yes ^
--terminal=no ^
--no-audio ^
--sub=no ^
--loop=inf ^
--fullscreen ^
--input-ipc-server=\\.\pipe\mpvsocket ^
"D:\Images\VideoWallpapers"

wp mv --wait --class mpv -x 1920
wp add --wait --fullscreen --class mpv
Francesco149 commented 4 years ago

yeah, you can't use class with multiple mpv's. you could set the window title by passing --title="something" to mpv and then using the window name to find it

phanirithvij commented 4 years ago

So I was able to do it like this

wp run mpv ^
--player-operation-mode=pseudo-gui ^
--force-window=yes ^
--terminal=no ^
--title=wp ^
--no-audio ^
--sub=no ^
--loop=inf ^
--fullscreen ^
--input-ipc-server=\\.\pipe\mpvsocket ^
"D:\Images\VideoWallpapers"

wp mv --wait --name wp -x 1920
wp add --wait --fullscreen --name wp

How can I kill that specific mpv instance?

Right now I'm doing

taskkill /im mpv.exe /f
wp.exe killall

Which kills all the running mpv instances.

Francesco149 commented 4 years ago

wp kill --name wp or wp killall --name wp

phanirithvij commented 4 years ago

It doesn't work. The mpv is still there. One more thing, I don't see wp in task manager when it is running

image

phanirithvij commented 4 years ago

Got something working to kill that wallpaper mpv instance (terrible hack sorry)

set cmd=powershell -c "get-process mpv | where-object {$_.mainwindowhandle -eq 0} | select-object Id"
:: https://stackoverflow.com/a/27429851/8608146
for /F "delims=" %%a in ('%cmd%') do (
   set "lastButOne=!lastLine!"
   set "lastLine=%%a"
)
taskkill /PID %lastLine% /f
REM timeout 5000

:: This does nothing (??)
wp.exe killall --name wp
Francesco149 commented 4 years ago

hmm that's strange. wp kill and wp killall both find the window in the same way wp mv does. so I don't see how it wouldn't find it. I'll look into this when i have time I guess

phanirithvij commented 4 years ago

The title of mpv is getting removed when it is set as a wallpaper for some reason. That's why I was able to filter that mpv process by no title and get the pid.

phanirithvij commented 4 years ago

Btw I am once again asking for the battlefield video wallpaper that's in th readme

Francesco149 commented 4 years ago

that makes sense. but how does the mv command work then? hmm

well if the window can't retain its title it's gonna be hard to make wp kill work

and I don't have that wallpaper anymore