-
Notifications
You must be signed in to change notification settings - Fork 15.3k
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
Add window opacity support #10667
Conversation
💖 Thanks for opening this pull request! 💖 Here is a list of things that will help get it across the finish line:
|
docs/api/browser-window.md
Outdated
@@ -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 |
There was a problem hiding this comment.
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 😄 )
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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 👍
Also there are a few linting issues, make sure to do a quick |
Congrats on merging your first pull request! 🎉🎉🎉 |
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.