Repository: microsoft/terminal
File: src/cascadia/WindowsTerminal/AppHost.cpp (C++)

Code before:
}

void AppHost::_IsQuakeWindowChanged(const winrt::Windows::Foundation::IInspectable&,
                                    const winrt::Windows::Foundation::IInspectable&)
{
    if (_window->IsQuakeWindow() && !_logic.IsQuakeWindow())
    {
        // If we're exiting quake mode, we should make our
        // tray icon disappear.
        if (_trayIconData)
        {
            Shell_NotifyIcon(NIM_DELETE, &_trayIconData.value());
            _trayIconData.reset();
        }
    }

    _window->IsQuakeWindow(_logic.IsQuakeWindow());
}

void AppHost::_HandleTrayIconPressed()
{
    // Currently scoping "minimize to tray" to only
    // the quake window.
    if (_logic.IsQuakeWindow())
    {
        _window->SummonWindow({});
    }
}

void AppHost::_HandleWindowHidden()
{
    if (_logic.IsQuakeWindow())
    {
        _UpdateTrayIcon();
    }
}

// Method Description:
// - Creates and adds an icon to the notification tray.
// Updates the current tray icon with the current window's
// HWND if an icon already exists.
// Arguments:
// - <unused>
// Return Value:
// - <none>
void AppHost::_UpdateTrayIcon()
{
    if (!_trayIconData)
    {
        NOTIFYICONDATA nid{};


Review comment (suggestion):
we should probably actually fill this with `DropdownDuration(200)`, so that pressing the tray icon will summon the window with the quake dropdown.

Code after:
        peasant.RequestRename(requestArgs);

        // Switch back to the UI thread. Setting the WindowName needs to happen
        // on the UI thread, because it'll raise a PropertyChanged event
        co_await ui_thread;

        if (requestArgs.Succeeded())
        {
            _logic.WindowName(args.ProposedName());
        }
        else
        {
            _logic.RenameFailed();
        }
    }
}

void AppHost::_HandleSettingsChanged(const winrt::Windows::Foundation::IInspectable& /*sender*/,
                                     const winrt::Windows::Foundation::IInspectable& /*args*/)
{
    _setupGlobalHotkeys();
}

void AppHost::_IsQuakeWindowChanged(const winrt::Windows::Foundation::IInspectable&,
                                    const winrt::Windows::Foundation::IInspectable&)
{
    if (_window->IsQuakeWindow() && !_logic.IsQuakeWindow())
    {
        // If we're exiting quake mode, we should make our
        // tray icon disappear.
        if (_trayIconData)
        {
            Shell_NotifyIcon(NIM_DELETE, &_trayIconData.value());
            _trayIconData.reset();
        }
    }
    else if (!_window->IsQuakeWindow() && _logic.IsQuakeWindow())
    {
        _UpdateTrayIcon();
    }

    _window->IsQuakeWindow(_logic.IsQuakeWindow());
}

void AppHost::_SummonWindowRequested(const winrt::Windows::Foundation::IInspectable& sender,
                                     const winrt::Windows::Foundation::IInspectable&)
{
    const Remoting::SummonWindowBehavior summonArgs{};
    summonArgs.MoveToCurrentDesktop(false);
    summonArgs.DropdownDuration(0);
    summonArgs.ToMonitor(Remoting::MonitorBehavior::InPlace);