marp-cli icon indicating copy to clipboard operation
marp-cli copied to clipboard

Adopt the Multi-Screen Window Placement API in bespoke template

Open yhatt opened this issue 3 years ago • 2 comments

Google Chrome 💯 has implemented Multi-Screen Window Placement API. It definitely matches to Marp's use case, the presenter view of Marp CLI's bespoke template.

  • Slideshow apps can show speaker notes on the internal primary screen and the presentation on an external projector.

— https://web.dev/multi-screen-window-placement/#use-cases

yhatt avatar Apr 02 '22 13:04 yhatt

Powered by the Multi-Screen Window Placement API, I've tried to implement a new behavior of "Open presenter view" button, for opening the presenter view into the current screen as an external window and making start the main view full screen into external screen at the same time.

However, I found both of operations cannot do at once with one click of the button. There are no workarounds because they are restrictions due to security reason.

If opened a window by window.open() first, requestFullscreen() gives up making the slide fullscreen with an error "cannot be initiated without a user gesture".

If run requestFullscreen() first, the browser will block opening a new window by window.open(). Users can permit opening the pop-up window from the browser notification, but I'm thinking it is hard to notice that because it has delivered quietly.

In addition, the Multi-Screen Window Placement API shows users the prompt to grant a permission. In the case of local HTML file (Marp's primary use), the browser will ask the permission each time of opening presenter view. Compared to the current behavior, users may feel irritated to the new behavior.

yhatt avatar Apr 02 '22 19:04 yhatt

https://chromestatus.com/feature/5173162437246976 WindowPlacementFullscreenCompanionWindow flag has been implemented in Chrome 103 and later. The first concern may resolve by this flag.

yhatt avatar May 31 '22 12:05 yhatt