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

Remove startOnUserLogin from the settings; use OS APIs only #18530

Merged
merged 12 commits into from
Feb 20, 2025

Conversation

DHowett
Copy link
Member

@DHowett DHowett commented Feb 7, 2025

Before we had a Settings UI, we added support for a setting called startOnUserLogin. It was a boolean, and on startup we would try to yeet the value of that setting into the Windows API responsible for registering us as a startup task.

Unfortunately, we failed to take into account a few things.

  • Startup tasks can be independently controlled by the user in Windows Settings or by an enterprise using enterprise policy
  • This control is not limited to disabling the task; it also supports enabling it!

Users could enable our startup task outside the settings file and we would never know it. We would load up, see that startOnUserLogin was false, and go disable the task again. 🤦

Conversely, if the user disables our task outside the app we can never enable it from inside the app. If an enterprise has configured it either direction, we can't change it either.

The best way forward is to remove it from our settings model and only ever interact with the Windows API.

This pull request replaces startOnUserLogin with a rich settings experience that will reflect the current and final state of the task as configured through Windows. Terminal will enable it if it can and display a message if it can't.

My first attempt at this PR (which you can read in the commit history) made us try harder to sync the state between the settings model and the OS; we would propagate the disabled state back to the user setting when the task was disabled in the OS or if we failed to enable it when the user asked for it. That was fragile and didn't support reporting the state in the settings UI, and it seems like it would be confusing for a setting to silently turn itself back off anyway...

Closes #12564

@DHowett
Copy link
Member Author

DHowett commented Feb 7, 2025

We could also go the other way and remove this setting from settings.json.

This comment has been minimized.

@htcfreek
Copy link

might be interesting to track "by policy" for showing in ui. 🤔

@DHowett DHowett changed the title WIP: Sync the startup task state with the OS more reliably Remove startOnUserLogin from the settings; use OS APIs only Feb 19, 2025
@microsoft-github-policy-service microsoft-github-policy-service bot added Issue-Bug It either shouldn't be doing this or needs an investigation. Area-UserInterface Issues pertaining to the user interface of the Console or Terminal Priority-2 A description (P2) Product-Terminal The new Windows Terminal. labels Feb 19, 2025
@DHowett
Copy link
Member Author

DHowett commented Feb 19, 2025

image
image
image

@DHowett DHowett marked this pull request as ready for review February 19, 2025 18:52
@htcfreek
Copy link

image
image
image

For UI consistency you should add a lock icon as on the AI page.

Copy link
Member

@lhecker lhecker left a comment

Choose a reason for hiding this comment

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

Nice! ...Lock symbol or not. 😄

@DHowett
Copy link
Member Author

DHowett commented Feb 20, 2025

image

lock icon

Copy link
Member

@carlos-zamora carlos-zamora left a comment

Choose a reason for hiding this comment

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

Nice work! Please be sure to update the docs site

}

_UpdateOverrideSystem();
_UpdateHelpText();
Copy link
Member

Choose a reason for hiding this comment

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

📝 This line is new

Copy link
Member Author

Choose a reason for hiding this comment

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

So yes! SettingContainer did not support dynamic updates to HelpText!

@DHowett DHowett merged commit a46fac2 into main Feb 20, 2025
17 of 19 checks passed
@DHowett DHowett deleted the dev/duhowett/startup-task-thoughts branch February 20, 2025 22:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-UserInterface Issues pertaining to the user interface of the Console or Terminal Issue-Bug It either shouldn't be doing this or needs an investigation. Priority-2 A description (P2) Product-Terminal The new Windows Terminal.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

We shouldn't have our own startup setting, we should just use the OS one
4 participants