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

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

Open
Wowfunhappy opened this issue Aug 7, 2022 · 2 comments

Comments

@Wowfunhappy
Copy link

Wowfunhappy commented Aug 7, 2022

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!

@thesobercoder
Copy link

thesobercoder commented Mar 27, 2023

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

@Wowfunhappy
Copy link
Author

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";
      }
    }

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

No branches or pull requests

2 participants