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

feat: enable windows control overlay on Windows #29600

Merged
merged 36 commits into from Aug 11, 2021

Conversation

mlaurencin
Copy link
Contributor

@mlaurencin mlaurencin commented Jun 9, 2021

Description of Change

This PR enhances titlebarStyle on Windows to support Window Controls Overlay. See this PR for the macOS implementation and other documentation. The parameter titlebarStyle: 'hidden' used with titleBarOverlay: true will turn on this feature on Windows with default system colors. Additionally for the Windows implementation, the color of the overlay buttons and its symbols can be specified by setting titleBarOverlay to an object with the options color and symbolColor respectively. As addressed in the open questions of the Window Controls Overlay specification, there is no current implementation for customizing the title bar height. This will be addressed in a future PR.

Checklist

Release Notes

Notes: Added support for Windows Control Overlay on Windows.

@electron-cation electron-cation bot added the new-pr 🌱 PR opened in the last 24 hours label Jun 9, 2021
@mlaurencin mlaurencin added 13-x-y 14-x-y semver/minor backwards-compatible functionality labels Jun 9, 2021
Copy link
Member

@MarshallOfSound MarshallOfSound left a comment

Choose a reason for hiding this comment

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

Requesting changes just so this doesn't land in the current state, we had some offline discussions mostly revolving around the large quantity of copied code in the windows PR but both PRs should be updated to only take effect when a new "overlay" tile bar style is defined. This should affect any existing apps.

@electron-cation electron-cation bot removed the new-pr 🌱 PR opened in the last 24 hours label Jun 16, 2021
@mlaurencin mlaurencin requested a review from a team as a code owner June 16, 2021 21:12
@weifeiyue
Copy link

awsome!! Can't wait to use this feature!!

jkleinsc added a commit that referenced this pull request Aug 24, 2021
* rebase "feat: enable windows control overlay on Windows"

* correct compilation error

* fix linting errors

* modify includes and build file

* change `hidden` option to `overlay`

* add patch to fix visual layout

* add button background color parameter

* add button text color parameter

* modify `overlay` in docs and modify button hover/press transition color

* change `text` to `symbol`

* remove todo and fix `text` replacement

* add new titleBarOverlay property and remove titleBarStyle `overlay`

* update browser and frameless window docs

* remove chromium patches

* chore: update patches

* change button hover color, update trailing `_`, update test file

* add dchecks, update title bar drawing checks, update test file

* modify for mac and linux builds

* update docs with overlayColor and overlaySymbolColor

* add corner and side hit test info

* modify docs and copyright info

* modify `titlebar_overlay_` as boolean or object

* move `title_bar_style_ to `NativeWindow`

* update docs with boolean and object titlebar_overlay_

* add `IsEmpty` checks

* move get options for boolean and object checks

* fix linting error

* disable `use_lld` for macos

* Update docs/api/frameless-window.md

Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>

* Update docs/api/frameless-window.md

Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>

* Update docs/api/frameless-window.md

Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>

* Apply docs suggestions from code review

Co-authored-by: Jeremy Rose <jeremya@chromium.org>

* modify `true` option description `titleBarOverlay`

* ci: cleanup keychain after tests on arm64 mac (#30472)

Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
Co-authored-by: Jeremy Rose <jeremya@chromium.org>

Co-authored-by: Michaela Laurencin <35157522+mlaurencin@users.noreply.github.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
Co-authored-by: Jeremy Rose <jeremya@chromium.org>
@trop
Copy link
Contributor

trop bot commented Aug 24, 2021

@jkleinsc has manually backported this PR to "14-x-y", please check out #30678

BlackHole1 pushed a commit to BlackHole1/electron that referenced this pull request Aug 30, 2021
* rebase "feat: enable windows control overlay on Windows"

* correct compilation error

* fix linting errors

* modify includes and build file

* change `hidden` option to `overlay`

* add patch to fix visual layout

* add button background color parameter

* add button text color parameter

* modify `overlay` in docs and modify button hover/press transition color

* change `text` to `symbol`

* remove todo and fix `text` replacement

* add new titleBarOverlay property and remove titleBarStyle `overlay`

* update browser and frameless window docs

* remove chromium patches

* chore: update patches

* change button hover color, update trailing `_`, update test file

* add dchecks, update title bar drawing checks, update test file

* modify for mac and linux builds

* update docs with overlayColor and overlaySymbolColor

* add corner and side hit test info

* modify docs and copyright info

* modify `titlebar_overlay_` as boolean or object

* move `title_bar_style_ to `NativeWindow`

* update docs with boolean and object titlebar_overlay_

* add `IsEmpty` checks

* move get options for boolean and object checks

* fix linting error

* disable `use_lld` for macos

* Update docs/api/frameless-window.md

Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>

* Update docs/api/frameless-window.md

Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>

* Update docs/api/frameless-window.md

Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>

* Apply docs suggestions from code review

Co-authored-by: Jeremy Rose <jeremya@chromium.org>

* modify `true` option description `titleBarOverlay`

* ci: cleanup keychain after tests on arm64 mac (electron#30472)

Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
Co-authored-by: Jeremy Rose <jeremya@chromium.org>
@trop
Copy link
Contributor

trop bot commented Sep 8, 2021

@mlaurencin has manually backported this PR to "13-x-y", please check out #30887

@aleksey-hoffman
Copy link

aleksey-hoffman commented Oct 8, 2021

@mlaurencin is it possible to trigger "Windows 11 snap layout" programmatically without using "native" title bar?
I have a custom titlebar in my app and I'm not sure if native titlbar allows similar customizability

@molant
Copy link
Contributor

molant commented Oct 8, 2021

@aleksey-hoffman have you look at https://web.dev/window-controls-overlay/ to see if it meets your needs?

If it doesn't, it might be good to open an issue in the original explainer:
https://github.com/WICG/window-controls-overlay/issues

@aleksey-hoffman
Copy link

@molant thanks for the links. It looks like the current implementation doesn't allow full customizability of the titlebar. It seems I will have to implement my own "Win 11 snap layouts" feature

@mlaurencin
Copy link
Contributor Author

@aleksey-hoffman unfortunately, I do not know of a way to trigger the snap layout programmatically.

Even if you are implementing your own feature, it might still be worth opening an issue on the explainer as mentioned above in case there are others wanting similar customizability.

@aleksey-hoffman
Copy link

@mlaurencin yep, I just checked, someone already opened an issue about this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api-review/approved ✅ semver/minor backwards-compatible functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet