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

macOS: Expose new Tao APIs #3840

Closed
wants to merge 3 commits into from

Conversation

betamos
Copy link
Contributor

@betamos betamos commented Apr 2, 2022

These changes exposes Tao APIs that are only affecting MacOS:

  • Window.show_application()
  • Window.hide_application()
  • Window.set_application_policy_at_runtime(..)

Following precedent set by set_activation_policy, these APIs are all target-gated to MacOS only.

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Docs
  • New Binding issue #___
  • Code style update
  • Refactor
  • Build-related changes
  • Other, please describe:

Does this PR introduce a breaking change?

  • Yes, and the changes were approved in issue #___
  • No

Checklist

  • When resolving issues, they are referenced in the PR's title (e.g fix: remove a typo, closes #___, #___)
  • A change file is added if any packages will require a version bump due to this PR per the instructions in the readme.
  • I have added a convincing reason for adding this feature, if necessary

Other information

Related to #2358.

@betamos betamos requested a review from a team April 2, 2022 02:48
@betamos betamos requested a review from a team as a code owner April 2, 2022 02:48
@@ -528,6 +529,21 @@ pub trait Dispatch<T: UserEvent>: Debug + Clone + Send + Sync + Sized + 'static
/// Hides the window.
fn hide(&self) -> Result<()>;

/// Shows the application on MacOS (independent of current window).
Copy link
Member

Choose a reason for hiding this comment

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

I think some more explanations would be helpful here, what does hiding the app mean in detail? Does it affect the dock icon? Does it affect Mission Control? Or the app quick switcher?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'd love to, but the only way to know would be experimental. Apple is deliberately vague about this, probably because things like dock and mission control are subject to changes across MacOS versions. Being more detailed than Apple's own docs won't be much help. Here's an example of what we call show_application:

https://developer.apple.com/documentation/appkit/nsapplication/1428761-unhide?language=objc

@amrbashir
Copy link
Member

This is the same as #3689, we won't merge this anytime soon. These api will have to wait for v2.

@betamos
Copy link
Contributor Author

betamos commented Apr 2, 2022

@amrbashir noted, and sorry for creating yet another duplicate PR. Same story, I didn't know this was already implemented. For context, these features are important for MacOS apps to behave in line with user expectations, that's likely why we both arrived at the same features.

Are we blocked due to feature freeze for 1.0 or because we haven't yet approved the API design? If the latter, we could parallelize the design discussions without putting load on the team.

Note the difference between this PR and #3689:

  • This PR also contains the set_activation_policy_at_runtime method.
  • This PR exposes methods on Window whereas the other exposes them at AppHandle (which is arguably a better design)

@amrbashir
Copy link
Member

It is blocked because we can't introduce new APIs that isn't audited so it will have to wait for v2 so it can be audited.

@lorenzolewis lorenzolewis changed the title MacOS: Expose new Tao APIs macOS: Expose new Tao APIs Jul 4, 2022
core/tauri-runtime/src/lib.rs Outdated Show resolved Hide resolved
core/tauri-runtime/src/lib.rs Outdated Show resolved Hide resolved
core/tauri-runtime/src/lib.rs Outdated Show resolved Hide resolved
core/tauri/src/window.rs Outdated Show resolved Hide resolved
core/tauri/src/window.rs Outdated Show resolved Hide resolved
core/tauri/src/window.rs Outdated Show resolved Hide resolved
@betamos betamos requested a review from a team as a code owner July 5, 2022 18:52
@lucasfernog
Copy link
Member

@betamos we've merged the show/hide APIs from #3689, can you open a new PR for the set_application_policy_at_runtime API, following the same strategy (adding the APIs to App and AppHandle instead of Window)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants