Repository: microsoft/PowerToys
File: src/modules/Workspaces/WorkspacesLauncher/AppLauncher.cpp (C++)

Code before:
            if (!names.empty())
            {
                Logger::trace(L"Launching packaged by protocol with command line args {}", app.name);

                std::wstring uriProtocolName = names[0];
                std::wstring command = std::wstring(uriProtocolName + (app.commandLineArgs.starts_with(L":") ? L"" : L":") + app.commandLineArgs);

                auto res = LaunchApp(command, L"", app.isElevated);
                if (res.isOk())
                {
                    launched = true;
                }
                else
                {
                    launchErrors.push_back({ std::filesystem::path(app.path).filename(), res.error() });
                }
            }
            else
            {
                Logger::info(L"Uri protocol names not found for {}", app.packageFullName);
            }
        }

        // packaged apps: try launching first by AppUserModel.ID
        // usage example: elevated Terminal
        if (!launched && !app.appUserModelId.empty())
        {
            Logger::trace(L"Launching {} as {}", app.name, app.appUserModelId);
            auto res = LaunchApp(L"shell:AppsFolder\\" + app.appUserModelId, app.commandLineArgs, app.isElevated);
            if (res.isOk())
            {
                launched = true;
            }
            else
            {
                Logger::error(L"Failed to launch by appUserModelId, {}, {}", app.name, app.appUserModelId);
                launchErrors.push_back({ std::filesystem::path(app.path).filename(), res.error() });
            }
        }

        // packaged apps: try launching by package full name
        // doesn't work for elevated apps or apps with command line args
        if (!launched && !app.packageFullName.empty() && app.commandLineArgs.empty() && !app.isElevated)
        {
            Logger::trace(L"Launching packaged app {}", app.name);
            launched = LaunchPackagedApp(app.packageFullName, launchErrors);
        }

        std::wstring appPathFinal;
        std::wstring commandLineArgsFinal;
        appPathFinal = app.path;

Review comment (suggestion):
Do you think we should just add a new one instead of modify existing one?
I mean if existing is for both ID not empty and FUllName not empty (like elevated Terminal), we don't mean to change it.
And your new logic, not sure if beside checking id is not empty, what more should be checked in case specific for Steam case.

Code after:
            if (!names.empty())
            {
                Logger::trace(L"Launching packaged by protocol with command line args {}", app.name);

                std::wstring uriProtocolName = names[0];
                std::wstring command = std::wstring(uriProtocolName + (app.commandLineArgs.starts_with(L":") ? L"" : L":") + app.commandLineArgs);

                auto res = LaunchApp(command, L"", app.isElevated);
                if (res.isOk())
                {
                    launched = true;
                }
                else
                {
                    launchErrors.push_back({ std::filesystem::path(app.path).filename(), res.error() });
                }
            }
            else
            {
                Logger::info(L"Uri protocol names not found for {}", app.packageFullName);
            }
        }

        // packaged apps: try launching first by AppUserModel.ID
        // usage example: elevated Terminal
        if (!launched && !app.appUserModelId.empty() && !app.packageFullName.empty())
        {
            Logger::trace(L"Launching {} as {} - {app.packageFullName}", app.name, app.appUserModelId, app.packageFullName);
            auto res = LaunchApp(L"shell:AppsFolder\\" + app.appUserModelId, app.commandLineArgs, app.isElevated);
            if (res.isOk())
            {
                launched = true;
            }
            else
            {
                launchErrors.push_back({ std::filesystem::path(app.path).filename(), res.error() });
            }
        }

        // win32 app with appUserModelId:
        // usage example: steam games
        if (!launched && !app.appUserModelId.empty())
        {
            Logger::trace(L"Launching {} as {}", app.name, app.appUserModelId);
            auto res = LaunchApp(L"shell:AppsFolder\\" + app.appUserModelId, app.commandLineArgs, app.isElevated);
            if (res.isOk())
            {
                launched = true;
            }
            else
            {