@Hadden89 said in Open PIP command (Alt+P):
@electryon The command may not builtin in but you can already do it without extensions.
Settings --> Quick Commands --> Command Chains --> New (+) --> Open Link in current tab --> this code javascript:var%20v=document.querySelector(%22video%22);v.removeAttribute(%22disablePictureInPicture%22);v.requestPictureInPicture();if(history.replaceState)%7Bwindowe.history.replaceState(%7B%7D,%22%22,location.href);%7D;
Add the new button to the toolbar if you will
Settings --> Keyboard --> Chains --> assign your keyboard shortcut.
Hi Hadden, this command had 2 issues.
It kept the javascript in the url, if there was no video in the page it also kept the javascript in the url.
It could only open the PIP window, it couldn't close it if it was open.
I have fixed the issue with the remaining javascript code in the url and I also made it to toggle the PIP.
Now it works the same way with the extension I had been using:)
javascript:var%20v=document.querySelector(%22video%22);if(history.replaceState)%7Bwindow.history.replaceState(%7B%7D,%22%22,location.href);%7D;v.removeAttribute(%22disablePictureInPicture%22);if(v!==document.pictureInPictureElement)%20v.requestPictureInPicture();else%20document.exitPictureInPicture();