microsoft / terminal

The new Windows Terminal and the original Windows console host, all in the same place!
MIT License
94.74k stars 8.2k forks source link

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

Open zadjii-msft opened 2 years ago

zadjii-msft commented 2 years ago

From MSFT:34529127

Steps to repro:

  1. Open Settings - App - Start up.
  2. Enable start up setting for Windows Terminal.
  3. Reboot.

Expected results: Windows Terminal can launch automatically after enter desktop and App start up setting should be on for Windows Terminal. Actual results: Windows Terminal can launch automatically after enter desktop, but App start up setting become off for Windows Terminal.


More notes, circa Dec 2023:

Okay so we all re-read all the docs and I think we were wrong entirely here.

We should have never had this setting in our settings JSON in the first place. It should have always just been backed by the OS setting. This probably dates back to us just having a JSON settings file. We should make the settings in the Terminal Settings UI reflect the OS settings. We shouldn't maintain our own separate setting.

We need the Windows Settings Startup being Enabled to trigger Windows to start Terminal on next reboot. And, we need the Terminal Settings Startup to be Enabled, to keep it in the Enabled state for Windows. If this is not enabled, when Windows launches Terminal after reboot, Terminal app itself disables the startup task here: https://github.com/microsoft/terminal/blob/306f31acf482ce84701aabee52981575277f16bb/src/cascadia/TerminalApp/AppLogic.cpp#L382

Quickly glancing through the Terminal code, Terminal Settings Startup relies on "startOnUserLogin" value and is saved in a default file. This value does not change if the user changes startup state in Windows Settings.

I am not sure, why the startup task is disabled when StartupTaskState::Enabled in the above link. But in my opinion it shouldn't be disabled if the user has enabled it in Windows settings. and use the value returned by StartupTask::GetAsync(StartupTaskName) for "startOnUserLogin".

[!Note]

Walkthrough

I need to write a new one!

We need to:

Griffin641498 commented 11 months ago

From MSFT:34529127

Steps to repro:

  1. Open Settings - App - Start up.
  2. Enable start up setting for Windows Terminal.
  3. Reboot.

Expected results: Windows Terminal can launch automatically after enter desktop and App start up setting should be on for Windows Terminal. Actual results: Windows Terminal can launch automatically after enter desktop, but App start up setting become off for Windows Terminal.

Note

Walkthrough

        <uap5:Extension Category="windows.startupTask">
          <uap5:StartupTask
            TaskId="StartTerminalOnLoginTask"
            Enabled="false"
            DisplayName="ms-resource:AppName" />
        </uap5:Extension>

That apparently can just be unset like:

        <uap5:Extension Category="windows.startupTask">
          <uap5:StartupTask
            TaskId="StartTerminalOnLoginTask"
            DisplayName="ms-resource:AppName" />
        </uap5:Extension>
Harsh-Avinash commented 10 months ago

I would love to take this up!

zadjii-msft commented 10 months ago

@Harsh-Avinash Go for it! Lemme know if you need any help ☺️