Skip to content

Fix CmdPal application activation #40162

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

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

jiripolasek
Copy link
Contributor

@jiripolasek jiripolasek commented Jun 20, 2025

Summary of the Pull Request

This PR:

  • Fixes the passing of activation arguments between instances.
  • Adds defensive handling of exceptions if the activation argument is corrupted.
  • Ensures that the activation method is consistently handled on the main thread.
  • Updates the condition under which the main window is displayed after startup or activation.

The main window will now be automatically shown when the app is started or activated, except in the following cases:

  • when started as a startup task,
  • when started using x-cmdpal://background,
  • when started using x-cmdpal://settings.

PR Checklist

Detailed Description of the Pull Request / Additional comments

Validation Steps Performed

Ensure that code invoked from `MainWindow.OnActivated` is dispatched to the main (UI) thread so that `MainWindow.HandleLaunch` is always invoked on the same thread.
Prevents potential COM exceptions when accessing properties of `AppActivationArguments` that may not be initialized correctly.
@jiripolasek jiripolasek changed the title Feature/39681 cmdpal.window wont open on click Fix CmdPal application activation Jun 20, 2025

This comment has been minimized.

… background, or settings modes

This commit ensures the main application window is shown upon launch or reactivation, addressing cases where it remained hidden and caused user confusion.

- Exclude visibility when started as a startup task to avoid interrupting system startup flow.
- Exclude when launched with `x-cmdpal://background` URI scheme.
- Exclude when launched with `x-cmdpal://settings` URI scheme.

This comment has been minimized.

- Add ‘CWMO’ to the spellchecker allow list to avoid flagging the acronym as a typo.
@jiripolasek
Copy link
Contributor Author

@zadjii-msft Hello, could you please check the PR summary and let me know if the conditions for displaying the main window are correct?

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.

1 participant