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: add option to not transform processes on win.SetVisibleOnAllWorkspaces #27200

Merged
merged 2 commits into from
Feb 2, 2021

Conversation

CyrusRoshan
Copy link
Contributor

@CyrusRoshan CyrusRoshan commented Jan 5, 2021

Description of Change

Allows calls to win.SetVisibleOnAllWorkspaces to skip transforming the process type. This allows us to use the same behavior found in Electron versions 9.2.1 and under, which is useful for "pinning" an app to a workspace/desktop, without causing other issues related to process transformation.

This PR adds optional backwards-compatibility with 9.2.1 and under, while maintaining the same default behavior.

Fixes: (#27101)
Process transformation introduced in this PR: PR #24956

Stakeholders:
@codebytere
@zcbenz
@MarshallOfSound

Checklist

Release Notes

Notes: Allowed skipping process type transformation in win.SetVisibleOnAllWorkspaces on macOS.

@welcome
Copy link

welcome bot commented Jan 5, 2021

💖 Thanks for opening this pull request! 💖

We use semantic commit messages to streamline the release process. Before your pull request can be merged, you should update your pull request title to start with a semantic prefix.

Examples of commit messages with semantic prefixes:

  • fix: don't overwrite prevent_default if default wasn't prevented
  • feat: add app.isPackaged() method
  • docs: app.isDefaultProtocolClient is now available on Linux

Things that will help get your PR 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.

@electron-cation electron-cation bot added the new-pr 🌱 PR opened in the last 24 hours label Jan 5, 2021
@CyrusRoshan CyrusRoshan force-pushed the optional-process-transformation branch 2 times, most recently from 09519a5 to e8cf0c7 Compare January 5, 2021 22:24
@rin1611 rin1611 mentioned this pull request Jan 8, 2021
2 tasks
@zcbenz
Copy link
Contributor

zcbenz commented Jan 11, 2021

This PR requires approval from @electron/wg-api since it adds a new option.

@zcbenz zcbenz changed the title fix: optionally transform processes on win.SetVisibleOnAllWorkspaces feat: add option to not transform processes on win.SetVisibleOnAllWorkspaces Jan 11, 2021
@zcbenz zcbenz added the semver/minor backwards-compatible functionality label Jan 11, 2021
@CyrusRoshan
Copy link
Contributor Author

Sweet, thank you! Let me know if there's anything I can do to help.

Copy link
Contributor

@jkleinsc jkleinsc left a comment

Choose a reason for hiding this comment

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

Adding this option looks good to me, but the documentation needs to be clearer as to the functionality it provides

@@ -1626,6 +1626,8 @@ Returns `Boolean` - Whether the menu bar is visible.
* `options` Object (optional)
* `visibleOnFullScreen` Boolean (optional) _macOS_ - Sets whether
the window should be visible above fullscreen windows
* `skipTransformProcessType` Boolean (optional) _macOS_ - Sets whether
the process type should be transformed. Default is `false`
Copy link
Contributor

Choose a reason for hiding this comment

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

While functionally true, this description doesn't seem really helpful to developers. Can you reword to provide better insight to developers as to why you would want to set this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure! How does the updated description sound?

@CyrusRoshan CyrusRoshan force-pushed the optional-process-transformation branch 2 times, most recently from 84f4a3d to eb44963 Compare January 20, 2021 01:32
Copy link
Contributor

@jkleinsc jkleinsc left a comment

Choose a reason for hiding this comment

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

@CyrusRoshan the updated description is a little more helpful but it is still unclear. I'm still not 100% clear why we are changing the process type and I think that's the part that needs clarifying. Maybe including more context from #27101 would be helpful. I'm trying to think of developers who don't have the context that you do if that makes sense.

Comment on lines 1629 to 1631
* `skipTransformProcessType` Boolean (optional) _macOS_ - Transforming
the process type must hide the window and dock for a short time. This
can be skipped if the process type has already been transformed.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
* `skipTransformProcessType` Boolean (optional) _macOS_ - Transforming
the process type must hide the window and dock for a short time. This
can be skipped if the process type has already been transformed.
* `skipTransformProcessType` Boolean (optional) _macOS_ - By default on macOS, setVisibleOnAllWorkspaces transforms the process type in order to hide the window and dock for a short time. If this is undesirable, setting this value to true will override that behavior.

Copy link
Contributor

@jkleinsc jkleinsc left a comment

Choose a reason for hiding this comment

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

@CyrusRoshan thanks for updating the description. It is much clearer now what this option does.

@zcbenz zcbenz force-pushed the optional-process-transformation branch from a7dddeb to f4c2e84 Compare February 2, 2021 10:11
@zcbenz
Copy link
Contributor

zcbenz commented Feb 2, 2021

This PR has got enough approvals from members of wg-api, it is a bug of bot that api-review/approved ✅ label can not be applied.

@zcbenz zcbenz merged commit 444ad26 into electron:master Feb 2, 2021
@welcome
Copy link

welcome bot commented Feb 2, 2021

Congrats on merging your first pull request! 🎉🎉🎉

@release-clerk
Copy link

release-clerk bot commented Feb 2, 2021

Release Notes Persisted

Allowed skipping process type transformation in win.SetVisibleOnAllWorkspaces on macOS.

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

Successfully merging this pull request may close these issues.

4 participants