Windowed icon indicating copy to clipboard operation
Windowed copied to clipboard

[feature request] add option to automatically go into a specific mode on every website

Open Wowfunhappy opened this issue 3 years ago • 3 comments

Hi, this extension is awesome! I have a shameless feature request. :3

It's already possible to tell this extension to always use e.g. in-window fullscreen mode on a specific website, such as youtube.com. However, I'd really like to change the default mode for every website I visit. Is this feasible?

In my specific case, I always want to use Windowed mode because when I really do want to fullscreen something, I'd rather use OS X's native fullscreen feature so the content appears in its own Mission Control space.

Thank you!

Wowfunhappy avatar Aug 07 '22 17:08 Wowfunhappy

@dralletje @Gitoffthelawn Would really appreciate this feature. Thanks for all your hard work!

thesobercoder avatar Mar 27 '23 18:03 thesobercoder

Alright, well I made a hack that works for me. On line 281 of content.js, I added:

mode = "windowed";

And now the extension always defaults to "windowed" mode. If you want it to default to something else, add mode = "fullscreen"; or mode = "in-window";, respectively.

If you click the extension icon to set a different behavior for a particular host, that will still work. Note that I'm using Chromium 114 and version 31 of the extension.


In case the line numbers change in the future, you want to find this block of code, in the let create_popup function:

    if (pip === true && video_element != null) {
      video_element.requestPictureInPicture();
      onEscapePress(() => {
        // @ts-ignore
        document.exitPictureInPicture();
      });
      return "PICTURE-IN-PICTURE";
    }


    if (mode === "fullscreen" || mode === "windowed" || mode === "in-window") {
      if (mode === "fullscreen") {
        let element = document.querySelector(`[data-${fullscreen_select}]`);
        disable_selector(element, fullscreen_select);
        element.requestFullscreen();
        return "FULLSCREEN";
      }
      if (mode === "windowed") {
        await go_into_fullscreen();
        return "WINDOWED";
      }
      if (mode === "in-window") {
        await go_in_window();
        return "IN-WINDOW";
      }
    }

and change it to:

    if (pip === true && video_element != null) {
      video_element.requestPictureInPicture();
      onEscapePress(() => {
        // @ts-ignore
        document.exitPictureInPicture();
      });
      return "PICTURE-IN-PICTURE";
    }
    mode = "windowed"; //WOWFUNHAPPY HACK TO DEFAULT TO WINDOWED MODE!
    if (mode === "fullscreen" || mode === "windowed" || mode === "in-window") {
      if (mode === "fullscreen") {
        let element = document.querySelector(`[data-${fullscreen_select}]`);
        disable_selector(element, fullscreen_select);
        element.requestFullscreen();
        return "FULLSCREEN";
      }
      if (mode === "windowed") {
        await go_into_fullscreen();
        return "WINDOWED";
      }
      if (mode === "in-window") {
        await go_in_window();
        return "IN-WINDOW";
      }
    }

Wowfunhappy avatar Jun 25 '23 16:06 Wowfunhappy