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

Add window opacity support #10667

Merged
merged 4 commits into from
Oct 4, 2017
Merged

Add window opacity support #10667

merged 4 commits into from
Oct 4, 2017

Conversation

dittos
Copy link
Contributor

@dittos dittos commented Oct 1, 2017

This PR adds support for controlling the opacity of BrowserWindow. It makes the entire window transparent - including system window borders.

Implemented on Windows and macOS.

@dittos dittos requested review from a team October 1, 2017 08:52
@welcome
Copy link

welcome bot commented Oct 1, 2017

💖 Thanks for opening this pull request! 💖

Here is a list of things that will help get it across the finish line:

  • Follow the JavaScript, C++, and Python coding style.
  • Run npm run lint locally to catch formatting errors earlier.
  • Document any user-facing changes you've made following the documentation styleguide.
  • Include tests when adding/changing behavior.
  • Include screenshots and animated GIFs whenever possible.
    We get a lot of pull requests on this repo, so please be patient and we will get back to you as soon as we can.

@@ -205,6 +205,8 @@ It creates a new `BrowserWindow` with native properties as set by the `options`.
`#FFF` (white).
* `hasShadow` Boolean (optional) - Whether window should have a shadow. This is only
implemented on macOS. Default is `true`.
* `opacity` Double (optional) - Set the initial opacity of the window, between 0.0 (fully
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Type should just be Number (JS doesn't really have different types 😄 )

Copy link
Contributor Author

@dittos dittos Oct 2, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I used Double here because it is used elsewhere several times. https://github.com/electron/electron/search?l=Markdown&q=double&type=&utf8=%E2%9C%93

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, not saying all our docs exactly follow what should be going on (we have a lot of docs 😆 ), but news ones should follow the style guide so that our ts converter has an easier job

@@ -631,6 +631,10 @@ bool Window::HasShadow() {
return window_->HasShadow();
}

void Window::SetOpacity(const double opacity) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For consistency with other API's we should probably have a GetOpacity as well 👍

@MarshallOfSound
Copy link
Member

Also there are a few linting issues, make sure to do a quick npm run lint before pushing up 👍

@zcbenz zcbenz merged commit 8c5bb59 into electron:master Oct 4, 2017
@welcome
Copy link

welcome bot commented Oct 4, 2017

Congrats on merging your first pull request! 🎉🎉🎉

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

Successfully merging this pull request may close these issues.

3 participants