Skip to content

Support Always Run As Administrator #3573

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

Open
wants to merge 120 commits into
base: dev
Choose a base branch
from
Open

Support Always Run As Administrator #3573

wants to merge 120 commits into from

Conversation

Jack251970
Copy link
Member

@Jack251970 Jack251970 commented May 22, 2025

Support Always Run As Administrator

Since some plugins may need administrator mode for handling sth, users may need to always run Flow Launcher as administrator.

We can edit RunLevel configuration for logon task and then Flow Launcher can be launched as admin mode during system startup.

If it is enabled, Flow will check if it is run as admin during every startup.

image

One more thing

And when running flow Launcher as administrator is launches all the other applications/programs also with administrator permission without showing any UAC prompt, this is a very big security issue, please look into the matters. 😊

We need to manually config Program plugin & Shell plugin so that it can handle running application as non-admin/admin correctly.

Additionally, many other codes related to Process.Start are checked.

Resolve #2639

Test

  • Change run as admin when Flow Launcher is run as admin/non-admin.
  • Check Flow Launcher logon task during application startup.
  • Run UWP/Win32 application as admin/non-admin when Flow Launcher is run as admin/non-admin. (admin right is correct & UAC dialog is shown correctly)
  • Run shell commands as admin/non-admin when Flow Launcher is run as admin/non-admin. (admin right is correct & UAC dialog is shown correctly)

@Jack251970 Jack251970 added this to the Future milestone May 22, 2025

This comment has been minimized.

@Jack251970 Jack251970 added the enhancement New feature or request label May 22, 2025
Copy link

gitstream-cm bot commented May 22, 2025

🥷 Code experts: onesounds

Jack251970, onesounds have most 👩‍💻 activity in the files.
Jack251970, onesounds have most 🧠 knowledge in the files.

See details

Flow.Launcher.Infrastructure/UserSettings/Settings.cs

Activity based on git-commit:

Jack251970 onesounds
MAY 41 additions & 19 deletions 2 additions & 2 deletions
APR 34 additions & 83 deletions 104 additions & 38 deletions
MAR 142 additions & 94 deletions 10 additions & 0 deletions
FEB 10 additions & 4 deletions
JAN 17 additions & 4 deletions
DEC 1 additions & 1 deletions

Knowledge based on git-blame:
Jack251970: 26%
onesounds: 21%

Flow.Launcher.Infrastructure/Win32Helper.cs

Activity based on git-commit:

Jack251970 onesounds
MAY 74 additions & 0 deletions
APR 202 additions & 33 deletions 4 additions & 0 deletions
MAR 581 additions & 226 deletions
FEB 13 additions & 16 deletions 22 additions & 0 deletions
JAN 0 additions & 138 deletions
DEC 243 additions & 4 deletions

Knowledge based on git-blame:
Jack251970: 95%

Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs

Activity based on git-commit:

Jack251970 onesounds
MAY 4 additions & 1 deletions 5 additions & 0 deletions
APR 228 additions & 27 deletions
MAR
FEB 38 additions & 28 deletions
JAN 21 additions & 3 deletions
DEC 8 additions & 73 deletions

Knowledge based on git-blame:
Jack251970: 47%
onesounds: 1%

Flow.Launcher/App.xaml.cs

Activity based on git-commit:

Jack251970 onesounds
MAY 13 additions & 4 deletions
APR 73 additions & 40 deletions 3 additions & 0 deletions
MAR 168 additions & 94 deletions
FEB 79 additions & 40 deletions
JAN 86 additions & 66 deletions
DEC

Knowledge based on git-blame:
Jack251970: 67%

Flow.Launcher/Helper/AutoStartup.cs

Activity based on git-commit:

Jack251970 onesounds
MAY
APR 90 additions & 45 deletions
MAR
FEB 36 additions & 8 deletions
JAN 112 additions & 8 deletions
DEC

Knowledge based on git-blame:
Jack251970: 83%

Flow.Launcher/Languages/en.xaml

Activity based on git-commit:

Jack251970 onesounds
MAY 12 additions & 3 deletions 15 additions & 2 deletions
APR 22 additions & 21 deletions 45 additions & 23 deletions
MAR 67 additions & 42 deletions 8 additions & 3 deletions
FEB 15 additions & 9 deletions
JAN 1 additions & 0 deletions
DEC

Knowledge based on git-blame:
onesounds: 43%
Jack251970: 11%

Flow.Launcher/MainWindow.xaml.cs

Activity based on git-commit:

Jack251970 onesounds
MAY 130 additions & 33 deletions 5 additions & 1 deletions
APR 69 additions & 45 deletions 5 additions & 1 deletions
MAR 1141 additions & 1076 deletions 327 additions & 141 deletions
FEB 1 additions & 1 deletions 8 additions & 4 deletions
JAN
DEC 5 additions & 10 deletions

Knowledge based on git-blame:
Jack251970: 68%
onesounds: 14%

Flow.Launcher/PublicAPIInstance.cs

Activity based on git-commit:

Jack251970 onesounds
MAY 109 additions & 70 deletions 110 additions & 50 deletions
APR 165 additions & 61 deletions
MAR 21 additions & 19 deletions
FEB 28 additions & 11 deletions
JAN 45 additions & 47 deletions
DEC 25 additions & 32 deletions

Knowledge based on git-blame:
Jack251970: 47%
onesounds: 9%

Flow.Launcher/Resources/Pages/WelcomePage5.xaml.cs

Activity based on git-commit:

Jack251970 onesounds
MAY 11 additions & 12 deletions
APR 42 additions & 23 deletions
MAR 7 additions & 6 deletions
FEB
JAN
DEC

Knowledge based on git-blame:
Jack251970: 55%
onesounds: 39%

Flow.Launcher/SettingPages/ViewModels/SettingsPaneGeneralViewModel.cs

Activity based on git-commit:

Jack251970 onesounds
MAY 15 additions & 4 deletions
APR 64 additions & 137 deletions 355 additions & 225 deletions
MAR 77 additions & 55 deletions
FEB 17 additions & 8 deletions
JAN 33 additions & 3 deletions
DEC

Knowledge based on git-blame:
Jack251970: 27%
onesounds: 16%

Flow.Launcher/SettingPages/Views/SettingsPaneGeneral.xaml

Activity based on git-commit:

Jack251970 onesounds
MAY 40 additions & 11 deletions
APR 11 additions & 8 deletions 130 additions & 69 deletions
MAR 44 additions & 20 deletions 43 additions & 62 deletions
FEB 1 additions & 1 deletions
JAN 8 additions & 1 deletions
DEC

Knowledge based on git-blame:
onesounds: 62%
Jack251970: 13%

Plugins/Flow.Launcher.Plugin.Program/Languages/en.xaml

Activity based on git-commit:

Jack251970 onesounds
MAY 7 additions & 5 deletions
APR 1 additions & 1 deletions
MAR
FEB 4 additions & 2 deletions
JAN
DEC

Knowledge based on git-blame:
onesounds: 25%
Jack251970: 4%

Plugins/Flow.Launcher.Plugin.Program/Main.cs

Activity based on git-commit:

Jack251970 onesounds
MAY
APR 187 additions & 139 deletions
MAR
FEB 96 additions & 14 deletions
JAN 60 additions & 8 deletions
DEC

Knowledge based on git-blame:
Jack251970: 59%

Plugins/Flow.Launcher.Plugin.Program/Programs/UWPPackage.cs

Activity based on git-commit:

Jack251970 onesounds
MAY
APR 10 additions & 11 deletions
MAR
FEB
JAN
DEC

Knowledge based on git-blame:
Jack251970: 1%

Plugins/Flow.Launcher.Plugin.Program/Programs/Win32.cs

Activity based on git-commit:

Jack251970 onesounds
MAY
APR 19 additions & 20 deletions
MAR
FEB
JAN
DEC

Knowledge based on git-blame:
Jack251970: 2%

To learn more about /:\ gitStream - Visit our Docs

Copy link

gitstream-cm bot commented May 22, 2025

Be a legend 🏆 by adding a before and after screenshot of the changes you made, especially if they are around UI/UX.

@Jack251970 Jack251970 requested a review from Copilot May 22, 2025 14:10
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds support for running Flow Launcher as administrator by updating startup configurations, user dialogs, and process launching logic. Key changes include:

  • Adding a UAC dialog for confirming elevation and updating related UI elements.
  • Modifying process launch methods to handle elevated and non-elevated launches based on user settings.
  • Enhancing auto-startup and settings logic to support an "Always Run As Administrator" option.

Reviewed Changes

Copilot reviewed 17 out of 17 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
Plugins/Flow.Launcher.Plugin.Program/UACDialog.xaml.cs New UAC dialog implementation for admin confirmation.
Plugins/Flow.Launcher.Plugin.Program/UACDialog.xaml UI layout for the UAC dialog.
Plugins/Flow.Launcher.Plugin.Program/Programs/Win32.cs Updates to launch processes with optional elevation and minor task configuration.
Plugins/Flow.Launcher.Plugin.Program/Programs/UWPPackage.cs Adjustments to launch UWP packages with elevation support.
Plugins/Flow.Launcher.Plugin.Program/Main.cs Added IsAdmin flag to identify current process elevation state.
Flow.Launcher/SettingPages/ViewModels/SettingsPaneGeneralViewModel.cs Updates to auto-startup handling and admin state checks in settings.
Other files (Languages, AutoStartup, App.xaml.cs, PublicAPIInstance.cs, Win32Helper.cs, Settings.cs) Various supporting changes to configuration, localization strings, and helper methods for administrator mode.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Contributor

coderabbitai bot commented May 22, 2025

📝 Walkthrough

"""

Walkthrough

This update introduces an option to always run Flow Launcher as administrator on startup. It adds a new user setting, updates the startup logic to handle privilege elevation, adjusts the UI and localization, and refactors process launching and restart mechanisms to support administrator mode. Supporting infrastructure and APIs are extended accordingly.

Changes

File(s) / Area Change Summary
Flow.Launcher.Infrastructure/UserSettings/Settings.cs, SettingPages/ViewModels/SettingsPaneGeneralViewModel.cs Added AlwaysRunAsAdministrator setting and property, integrated into settings and view model logic.
Flow.Launcher/SettingPages/Views/SettingsPaneGeneral.xaml, Languages/en.xaml Updated UI to add toggle for "Always Run as Administrator" and added related localization strings.
Flow.Launcher/App.xaml.cs, Helper/AutoStartup.cs, Resources/Pages/WelcomePage5.xaml.cs Startup logic updated to support admin mode, propagate new setting, and handle privilege elevation and restart.
Flow.Launcher.Infrastructure/Win32Helper.cs, NativeMethods.txt, Constant.cs Added admin privilege checks, process launching as desktop user, and related native method declarations/constants.
Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs, PublicAPIInstance.cs Extended plugin API for process start with elevation and restart as admin.
Plugins/Flow.Launcher.Plugin.Program/Programs/UWPPackage.cs, Programs/Win32.cs, Plugin.Shell/Main.cs Refactored plugin process launching to use new API and support elevation.
Flow.Launcher.Core/Configuration/Portable.cs, Updater.cs Changed restart mechanism to use new API methods.
Flow.Launcher.Command/ (Program.cs, .csproj, PublishProfiles, etc.), Flow.Launcher.sln Added new helper project for process launching, integrated into solution and build.
Flow.Launcher.Infrastructure/Http/Http.cs, Plugins/Flow.Launcher.Plugin.Shell/Languages/en.xaml Minor code or formatting changes (no functional impact).

Sequence Diagram(s)

Loading
sequenceDiagram
    participant User
    participant SettingsPane
    participant App
    participant Win32Helper
    participant AutoStartup
    participant OS

    User->>SettingsPane: Enable "Always Run as Administrator"
    SettingsPane->>App: Update setting, trigger startup logic
    App->>Win32Helper: Check if running as admin
    Win32Helper-->>App: Return privilege status
    App->>App: If not admin, call RestartApp(forceAdmin=true)
    App->>OS: Relaunch Flow Launcher with elevation
    OS-->>App: Flow Launcher starts as administrator
Loading
sequenceDiagram
    participant Plugin
    participant PublicAPI
    participant Win32Helper
    participant Flow.Launcher.Command
    participant OS

    Plugin->>PublicAPI: StartProcess(..., verb="runas")
    PublicAPI->>Win32Helper: If admin, RunAsDesktopUser(...)
    Win32Helper->>Flow.Launcher.Command: Launch process as desktop user
    Flow.Launcher.Command->>OS: Start target process
    OS-->>Plugin: Target process runs with correct privileges

Assessment against linked issues

Objective Addressed Explanation
Add an option in General settings to always run Flow Launcher as Administrator on startup (#2639)
Ensure the application restarts with admin privileges if the option is enabled (#2639)
Update startup logic, task scheduling, and plugin APIs to support admin mode (#2639)
UI and localization changes for new admin option (#2639)

Poem

A toggle appears, with a hop and a cheer,
"Run as admin"—now Flow Launcher’s clear!
With privileges high, it leaps to the sky,
Restarting itself, so plugins comply.
The code hops along, permissions in tow,
🐇✨ Now admin mode’s only a click to bestow!
"""


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7de9d25 and f02a6c5.

📒 Files selected for processing (1)
  • Flow.Launcher/SettingPages/Views/SettingsPaneGeneral.xaml (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • Flow.Launcher/SettingPages/Views/SettingsPaneGeneral.xaml
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: build
  • GitHub Check: Check Spelling

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 8

🔭 Outside diff range comments (1)
Flow.Launcher/Helper/AutoStartup.cs (1)

173-200: 🛠️ Refactor suggestion

Add error handling for administrator privilege settings.

The method doesn't explicitly check if setting the RunLevel was successful, which could lead to silent failures.

 private static bool ScheduleLogonTask(bool alwaysRunAsAdministrator)
 {
     using var td = TaskService.Instance.NewTask();
     td.RegistrationInfo.Description = LogonTaskDesc;
     td.Triggers.Add(new LogonTrigger { UserId = WindowsIdentity.GetCurrent().Name, Delay = TimeSpan.FromSeconds(2) });
     td.Actions.Add(Constant.ExecutablePath);

+    bool requestedElevation = false;
     // Only if the app is running as administrator, we can set the run level to highest
     if (Win32Helper.IsAdministrator() && alwaysRunAsAdministrator)
     {
         td.Principal.RunLevel = TaskRunLevel.Highest;
+        requestedElevation = true;
     }

     td.Settings.StopIfGoingOnBatteries = false;
     td.Settings.DisallowStartIfOnBatteries = false;
     td.Settings.ExecutionTimeLimit = TimeSpan.Zero;

     try
     {
-        TaskService.Instance.RootFolder.RegisterTaskDefinition(LogonTaskName, td);
+        var registeredTask = TaskService.Instance.RootFolder.RegisterTaskDefinition(LogonTaskName, td);
+        
+        // Verify that elevation was set if requested
+        if (requestedElevation && registeredTask.Definition.Principal.RunLevel != TaskRunLevel.Highest)
+        {
+            App.API.LogWarning(ClassName, "Failed to set task to run with highest privileges");
+            // We don't fail the operation, just log a warning
+        }
+        
         return true;
     }
     catch (Exception e)
     {
         App.API.LogError(ClassName, $"Failed to schedule logon task: {e}");
         return false;
     }
 }
🧹 Nitpick comments (10)
Flow.Launcher/SettingPages/Views/SettingsPaneGeneral.xaml (1)

56-66: Consider adding a warning about security implications.

Running applications with administrator privileges can have security implications. Consider adding a more detailed tooltip or warning about the potential risks of always running with elevated privileges.

Example enhancement:

<cc:Card
    Title="{DynamicResource alwaysRunAsAdministrator}"
    Icon="&#xE7EF;"
-   Sub="{DynamicResource alwaysRunAsAdministratorToolTip}">
+   Sub="{DynamicResource alwaysRunAsAdministratorToolTip}"
+   Style="{StaticResource WarningCardStyle}">
    <ui:ToggleSwitch
        IsOn="{Binding AlwaysRunAsAdministrator}"
        OffContent="{DynamicResource disable}"
        OnContent="{DynamicResource enable}" />
</cc:Card>

Note: This assumes a WarningCardStyle exists or would need to be created.

Plugins/Flow.Launcher.Plugin.Program/UACDialog.xaml.cs (3)

12-13: Consider adding XML documentation and using consistent naming conventions for static fields.

Both msgBox and _result are static fields, but they use inconsistent naming conventions. Consider prefixing both with underscore for consistency, or use a consistent naming style.

-        private static UACDialog msgBox;
+        private static UACDialog _msgBox;
         private static MessageBoxResult _result = MessageBoxResult.None;

68-78: Clean up dialog instance consistently in button handlers.

The Button_Click method sets the dialog instance to null, but the field is static and might be accessed from other threads. Consider applying the same pattern to the KeyEsc_OnPress method.

     private void KeyEsc_OnPress(object sender, ExecutedRoutedEventArgs e)
     {
         DialogResult = false;
         Close();
+        _result = MessageBoxResult.None;
+        _msgBox = null;
     }

     private void Button_Click(object sender, RoutedEventArgs e)
     {
         if (sender == btnYes)
             _result = MessageBoxResult.Yes;
         else if (sender == btnNo)
             _result = MessageBoxResult.No;
         else
             _result = MessageBoxResult.None;
-        msgBox.Close();
-        msgBox = null;
+        _msgBox.Close();
+        _msgBox = null;
     }

80-85: Use consistent naming in Button_Cancel method.

The Button_Cancel method references msgBox directly, but should use the renamed field if you adopt the suggestion above.

     private void Button_Cancel(object sender, RoutedEventArgs e)
     {
         _result = MessageBoxResult.Cancel;
-        msgBox.Close();
-        msgBox = null;
+        _msgBox.Close();
+        _msgBox = null;
     }
Flow.Launcher/Helper/AutoStartup.cs (1)

120-131: Document startup method changes for administrator mode.

The code includes a good comment explaining why registry startup doesn't support administrator mode, but could benefit from additional documentation.

 public static void ChangeToViaLogonTask(bool alwaysRunAsAdministrator)
 {
     Disable(false);
     Enable(true, alwaysRunAsAdministrator);
 }

 public static void ChangeToViaRegistry()
 {
     Disable(true);
+    // Registry startup doesn't support running as administrator because it doesn't have an option
+    // to elevate privileges like the Task Scheduler does with RunLevel.Highest
     // We do not need to use alwaysRunAsAdministrator for registry, so we just set false here
     Enable(false, false);
 }
Flow.Launcher/SettingPages/ViewModels/SettingsPaneGeneralViewModel.cs (5)

4-5: Namespace collision risk between WPF and WinForms types

Adding using System.Windows; to a file that is already importing System.Windows.Forms increases the likelihood of ambiguous type resolutions (MessageBox, Screen, DragEventArgs, …).
Although you currently reference the enumerations by their full namespace (MessageBoxButton, MessageBoxResult) the next developer who tries to call MessageBox.Show (or similar) will hit a compile-time ambiguity.

Two low-effort mitigations:

-using System.Windows;
+using Wpf = System.Windows;

or import only the specific WPF types you need:

using System.Windows.MessageBoxButton;
using System.Windows.MessageBoxResult;

Either option keeps the intent clear and shields you from hidden compilation errors down the road.


26-27: Static cache of elevation status can become stale after restart-in-place

_isAdministrator is captured once when the SettingsPaneGeneralViewModel type is first touched.
If (in a future enhancement) you decide to elevate the process without a full application restart, this flag will remain false, giving you inconsistent behaviour.

Safer alternative: turn it into a computed property or refresh it inside CheckAdminChangeAndAskForRestart() right before the comparison.

-private static readonly bool _isAdministrator = Win32Helper.IsAdministrator();
+private static bool IsAdministrator => Win32Helper.IsAdministrator();

Then replace usages accordingly.


72-78: Restart prompt executes even when startup-task creation fails

CheckAdminChangeAndAskForRestart() is invoked regardless of whether AutoStartup.ChangeToViaLogonTask threw.
In the failure path we show the user two dialogs: one for the error and then another asking for a restart—yet we know the scheduled task is still out of sync.

Consider short-circuiting when the startup change fails or basing the restart prompt on the success flag returned by the helper.


94-113: Duplicate logic – consider extracting a helper

The UseLogonTaskForStartup setter repeats almost the same try/catch & restart-check block found in StartFlowLauncherOnSystemStartup.
Extracting this into a private method (e.g. UpdateStartupMethod(bool viaLogonTask)) would keep the two setters terse and DRY.


141-154: Restart helper could lose original command-line context

App.API.RestartApp(AlwaysRunAsAdministrator ? "runas" : string.Empty); forwards only the elevation flag.
If the user had started Flow Launcher with extra CLI arguments (portable mode, debug flags, etc.) they will be dropped during restart.

Recommend overloading RestartApp to accept an argument builder or capture Environment.GetCommandLineArgs() and re-use them when invoking the new process.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2026bb7 and fe70a72.

📒 Files selected for processing (17)
  • Flow.Launcher.Infrastructure/UserSettings/Settings.cs (1 hunks)
  • Flow.Launcher.Infrastructure/Win32Helper.cs (2 hunks)
  • Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs (1 hunks)
  • Flow.Launcher/App.xaml.cs (1 hunks)
  • Flow.Launcher/Helper/AutoStartup.cs (7 hunks)
  • Flow.Launcher/Languages/en.xaml (2 hunks)
  • Flow.Launcher/MainWindow.xaml.cs (1 hunks)
  • Flow.Launcher/PublicAPIInstance.cs (2 hunks)
  • Flow.Launcher/Resources/Pages/WelcomePage5.xaml.cs (1 hunks)
  • Flow.Launcher/SettingPages/ViewModels/SettingsPaneGeneralViewModel.cs (6 hunks)
  • Flow.Launcher/SettingPages/Views/SettingsPaneGeneral.xaml (1 hunks)
  • Plugins/Flow.Launcher.Plugin.Program/Languages/en.xaml (1 hunks)
  • Plugins/Flow.Launcher.Plugin.Program/Main.cs (3 hunks)
  • Plugins/Flow.Launcher.Plugin.Program/Programs/UWPPackage.cs (4 hunks)
  • Plugins/Flow.Launcher.Plugin.Program/Programs/Win32.cs (5 hunks)
  • Plugins/Flow.Launcher.Plugin.Program/UACDialog.xaml (1 hunks)
  • Plugins/Flow.Launcher.Plugin.Program/UACDialog.xaml.cs (1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (2)
Flow.Launcher/Resources/Pages/WelcomePage5.xaml.cs (1)
Flow.Launcher/Helper/AutoStartup.cs (2)
  • AutoStartup (12-230)
  • ChangeToViaLogonTask (120-124)
Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs (2)
Flow.Launcher/PublicAPIInstance.cs (1)
  • RestartApp (75-75)
Flow.Launcher.Core/Plugin/JsonRPCV2Models/JsonRPCPublicAPI.cs (1)
  • RestartApp (27-30)
🪛 GitHub Actions: Check Spelling
Flow.Launcher/App.xaml.cs

[warning] 63-63: WMP is not a recognized word. (unrecognized-spelling)


[warning] 106-119: Ioc is not a recognized word. (unrecognized-spelling)


[warning] 174-174: Ioc is not a recognized word. (unrecognized-spelling)


[warning] 199-199: Loadertask is not a recognized word. (unrecognized-spelling)


[warning] 225-225: VSTHRD is not a recognized word. (unrecognized-spelling)

Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs

[warning] 216-216: spefic is not a recognized word. (unrecognized-spelling)


[warning] 357-357: requerying is not a recognized word. (unrecognized-spelling)

Plugins/Flow.Launcher.Plugin.Program/Programs/UWPPackage.cs

[warning] 91-94: uap and rescap are not recognized words. (unrecognized-spelling)


[warning] 462-462: dlgtitle is not a recognized word. (unrecognized-spelling)


[warning] 535-535: uap is not a recognized word. (unrecognized-spelling)

Flow.Launcher/MainWindow.xaml.cs

[warning] 61-61: WMP is not a recognized word. (unrecognized-spelling)


[warning] 100-100: VSTHRD is not a recognized word. (unrecognized-spelling)


[warning] 460-475: VSTHRD is not a recognized word. (unrecognized-spelling)


[warning] 564-566: WMP is not a recognized word. (unrecognized-spelling)


[warning] 652-678: gamemode and positionreset are not recognized words. (unrecognized-spelling)


[warning] 794-795: XRatio and YRatio are not recognized words. (unrecognized-spelling)


[warning] 1009-1018: clocksb and iconsb are not recognized words. (unrecognized-spelling)

Plugins/Flow.Launcher.Plugin.Program/Main.cs

[warning] 20-20: Reloadable is not a recognized word. (unrecognized-spelling)


[warning] 46-47: unins and uninst are not recognized words. (unrecognized-spelling)


[warning] 50-50: Uninstaller is not a recognized word. (unrecognized-spelling)


[warning] 66-68: desinstalar is not a recognized word. (unrecognized-spelling)


[warning] 78-79: Uninstaller is not a recognized word. (unrecognized-spelling)


[warning] 135-137: Uninstallers is not a recognized word. (unrecognized-spelling)


[warning] 142-145: uninst, uninstaller, and Uninstaller are not recognized words. (unrecognized-spelling)


[warning] 145-157: Prefixs and uninstaller are not recognized words. (unrecognized-spelling)


[warning] 389-449: dlgtitle is not a recognized word. (unrecognized-spelling)

Plugins/Flow.Launcher.Plugin.Program/UACDialog.xaml

[warning] 2-2: UAC is not a recognized word. (unrecognized-spelling)

Plugins/Flow.Launcher.Plugin.Program/Programs/Win32.cs

[warning] 223-224: UAC is not a recognized word. (unrecognized-spelling)


[warning] 231-231: workaround is not a recognized word. (unrecognized-spelling)

Plugins/Flow.Launcher.Plugin.Program/UACDialog.xaml.cs

[warning] 2-2: UAC is not a recognized word. (unrecognized-spelling)

Flow.Launcher.Infrastructure/Win32Helper.cs

[warning] 42-42: Dwm is not a recognized word. (unrecognized-spelling)


[warning] 54-54: DWMSBT and SYSTEMBACKDROP are not recognized words. (unrecognized-spelling)


[warning] 55-55: DWMSBT and SYSTEMBACKDROP are not recognized words. (unrecognized-spelling)


[warning] 56-56: DWMSBT and SYSTEMBACKDROP are not recognized words. (unrecognized-spelling)


[warning] 59-59: Dwm and PInvoke are not recognized words. (unrecognized-spelling)


[warning] 61-61: DWMWA, DWMWINDOWATTRIBUTE, and SYSTEMBACKDROP are not recognized words. (unrecognized-spelling)


[warning] 70-70: Dwm and PInvoke are not recognized words. (unrecognized-spelling)


[warning] 72-72: DWMWA and DWMWINDOWATTRIBUTE are not recognized words. (unrecognized-spelling)


[warning] 88-90: DWMWCP is not a recognized word. (unrecognized-spelling)


[warning] 94-94: Dwm and PInvoke are not recognized words. (unrecognized-spelling)


[warning] 96-96: DWMWA and DWMWINDOWATTRIBUTE are not recognized words. (unrecognized-spelling)


[warning] 107-107: PInvoke is not a recognized word. (unrecognized-spelling)


[warning] 162-189: GWL is not a recognized word. (unrecognized-spelling)


[warning] 198-210: Wnd is not a recognized word. (unrecognized-spelling)


[warning] 239-239: Wnd is not a recognized word. (unrecognized-spelling)


[warning] 263-277: WINTAB, Progman, and WORKERW are not recognized words. (unrecognized-spelling)


[warning] 517-523: hkl is not a recognized word. (unrecognized-spelling)


[warning] 549-549: nqo is not a recognized word. (unrecognized-spelling)


[warning] 622-646: tsf and Tsf are not recognized words. (unrecognized-spelling)


[warning] 682-685: Noto is not a recognized word. (unrecognized-spelling)


[warning] 726-751: noto is not a recognized word. (unrecognized-spelling)

⏰ Context from checks skipped due to timeout of 90000ms (5)
  • GitHub Check: gitStream workflow automation
  • GitHub Check: gitStream.cm
  • GitHub Check: gitStream.cm
  • GitHub Check: gitStream.cm
  • GitHub Check: build
🔇 Additional comments (25)
Flow.Launcher.Infrastructure/Win32Helper.cs (2)

8-8: New dependency added for administrator check.

Good addition of the System.Security.Principal namespace, which is required for the new IsAdministrator() method implementation.


758-767: Well-implemented administrator check method.

The IsAdministrator() method follows the standard pattern for detecting administrator privileges in Windows applications using WindowsPrincipal and WindowsBuiltInRole. This centralized implementation will help maintain consistency when checking for elevated permissions throughout the application.

Flow.Launcher.Infrastructure/UserSettings/Settings.cs (1)

375-375: New setting for administrator mode.

Good implementation of the AlwaysRunAsAdministrator property with a sensible default value of false. This ensures that the application doesn't unexpectedly run with elevated permissions unless explicitly configured by the user.

Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs (1)

36-41: New API method for restarting with arguments.

The addition of RestartApp(string arguments) method to the public API will allow the application to restart with custom command-line arguments, which is essential for implementing the administrator mode toggle functionality.

Plugins/Flow.Launcher.Plugin.Program/Languages/en.xaml (1)

100-102: LGTM! User Account Control strings are well-structured.

The new localization strings for the UAC dialog look good. They follow the standard Windows UAC prompt format with a title, confirmation question, and program location display.

Flow.Launcher/App.xaml.cs (1)

239-239: LGTM! Successfully added administrator parameter to auto-startup check.

The change properly passes the new AlwaysRunAsAdministrator setting to the CheckIsEnabled method, ensuring that auto-startup respects the administrator mode preference.

Flow.Launcher/MainWindow.xaml.cs (1)

598-605: LGTM! Notify icon now shows administrator status correctly.

Good implementation of conditional text for the notify icon tooltip. This provides clear visual feedback to users when the application is running with elevated privileges.

Flow.Launcher/SettingPages/Views/SettingsPaneGeneral.xaml (1)

47-66: LGTM! Well-structured UI for administrator mode settings.

The new UI elements for administrator mode are well-organized. The CardGroup approach logically groups the related startup settings together, and the toggle for "Always Run as Administrator" is properly bound to the corresponding property in the view model.

I particularly like the choice of icons - the shield icon () is perfect for representing administrator privileges, making the purpose of the setting immediately clear to users.

Plugins/Flow.Launcher.Plugin.Program/Main.cs (3)

6-6: Appropriate addition of required namespace.

Adding the System.Security.Principal namespace is necessary for the WindowsIdentity and WindowsPrincipal classes used in the new IsAdministrator method.


36-36: Good addition of an administrator status indicator.

This static boolean field provides a centralized way to determine the current administrator status within the plugin, properly initialized using the IsAdministrator method.


466-471: Well-implemented administrator check method.

The IsAdministrator method follows the standard pattern for checking Windows administrator privileges:

  1. Gets the current Windows identity
  2. Creates a principal from this identity
  3. Checks if the principal is in the Administrator role

The implementation is clean and correctly disposes of the WindowsIdentity object with a using statement.

Flow.Launcher/Languages/en.xaml (2)

49-49: Good addition of admin indicator label.

This localized string will be used to indicate administrator mode in the UI, supporting the new feature.


135-138: Complete set of localization strings for administrator mode.

The added strings provide comprehensive text resources for the administrator mode functionality:

  1. Toggle label for the setting
  2. Tooltip explaining the functionality
  3. Dialog title for mode change
  4. Confirmation message for restart

These strings ensure the feature is properly localized and user-friendly.

Flow.Launcher/PublicAPIInstance.cs (3)

75-75: Good addition of parameter-less overload for backward compatibility.

Adding an overload that calls the parameterized version with null maintains compatibility with existing code while extending functionality.


78-78: Enhancement of RestartApp to support command-line arguments.

The method signature change allows passing arguments to the application when restarting, which is essential for the administrator mode feature.


93-93: Properly passing arguments to the UpdateManager.

The UpdateManager.RestartApp call is now correctly passing the arguments parameter, enabling restart with custom command-line options.

Plugins/Flow.Launcher.Plugin.Program/Programs/UWPPackage.cs (3)

458-458: Good refactoring to centralize launch logic.

Replacing inline launch code with a call to the dedicated Launch method improves code maintainability and consistency.


502-502: Consistent use of centralized launch method.

Using the same Launch method from the context menu handler ensures consistent behavior between different launch scenarios.


514-527: Well-implemented launch method with proper object initialization.

The refactored Launch method:

  1. Uses object initializer syntax for ProcessStartInfo which is cleaner
  2. Properly sets UseShellExecute and Verb properties
  3. Correctly executes the process asynchronously with Task.Run
  4. Uses ConfigureAwait(false) to avoid context capturing

This implementation properly handles elevation requests through the "runas" verb when needed.

Plugins/Flow.Launcher.Plugin.Program/Programs/Win32.cs (2)

199-202: Simplified code by using the new Launch method.

The code now uses a centralized Launch method for starting processes, which improves code organization and reusability.


271-272: Simplified "Run as administrator" context menu implementation.

The code now uses the centralized Launch method with elevated=true parameter, improving code organization.

Flow.Launcher/Helper/AutoStartup.cs (2)

20-52: Add administrator privilege support to startup checking.

The changes correctly implement the ability to run Flow Launcher with administrator privileges at startup by adding an alwaysRunAsAdministrator parameter.


54-84: Add administrator privilege support to logon task checking.

The changes allow checking if the logon task is set to run with administrator privileges.

Flow.Launcher/SettingPages/ViewModels/SettingsPaneGeneralViewModel.cs (1)

55-56:

✅ Verification successful

Verify all call-sites migrated to new ChangeToViaLogonTask(bool) signature

The extra parameter has been provided here, but older call-sites elsewhere in the codebase will silently compile if they rely on overload resolution (e.g. optional parameters) or might now fail.
Please run a sweep to ensure no stale overloads remain:


🏁 Script executed:

rg -n "ChangeToViaLogonTask(" --type cs

Length of output: 134


Let’s re-run the search using a fixed-string match to avoid regex errors:


🏁 Script executed:

#!/bin/bash
rg -n -F "ChangeToViaLogonTask(" --type cs

Length of output: 755


All ChangeToViaLogonTask calls now use the new bool parameter
Verified via rg -F "ChangeToViaLogonTask(" --type cs—no parameterless calls remain.

Call-sites updated:

  • Resources/Pages/WelcomePage5.xaml.cs:48
  • SettingPages/ViewModels/SettingsPaneGeneralViewModel.cs:55, 94, 127

Definition in Helper/AutoStartup.cs only exposes ChangeToViaLogonTask(bool), so no stale overloads exist.

Flow.Launcher/Resources/Pages/WelcomePage5.xaml.cs (1)

48-48: Code correctly implements administrator mode setting for startup

The change properly passes the AlwaysRunAsAdministrator setting to the ChangeToViaLogonTask method, ensuring that Flow Launcher will respect the user's preference for running with elevated privileges on system startup. This aligns with the PR objective of supporting plugins that require administrator mode.

This comment has been minimized.

@Jack251970 Jack251970 requested a review from Copilot May 22, 2025 14:17

This comment has been minimized.

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds support for launching Flow Launcher as administrator by introducing a new AlwaysRunAsAdministrator setting and updating the process launching, auto-start, and UAC dialog functionalities accordingly. Key changes include:

  • Adding a new AlwaysRunAsAdministrator property in settings and updating the settings UI.
  • Modifying the logon task and process launch logic throughout the application to account for administrator mode.
  • Enhancing the UAC dialog and related helper methods to support elevated launch flows.

Reviewed Changes

Copilot reviewed 17 out of 17 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
Plugins/Flow.Launcher.Plugin.Program/UACDialog.xaml.cs Added a UAC dialog for confirming elevation with asynchronous image loading.
Plugins/Flow.Launcher.Plugin.Program/Programs/Win32.cs Updated process launching logic to conditionally show the UAC dialog and to handle elevated launch.
Plugins/Flow.Launcher.Plugin.Program/Programs/UWPPackage.cs Modified UWP package launch flow to support administrator mode with updated auto-start handling.
Flow.Launcher/SettingPages/Views/SettingsPaneGeneral.xaml Integrated a new toggle for AlwaysRunAsAdministrator in the settings UI.
Flow.Launcher/SettingPages/ViewModels/SettingsPaneGeneralViewModel.cs Updated logon task startup logic to include the administrator mode flag.
Flow.Launcher/Helper/AutoStartup.cs Adjusted logon task scheduling to incorporate the AlwaysRunAsAdministrator parameter.
Flow.Launcher/PublicAPIInstance.cs Provided an overload of RestartApp to accept command-line arguments for admin mode restart.
Flow.Launcher/Infrastructure/Win32Helper.cs Added a helper method to check administrator status.
Flow.Launcher/Infrastructure/UserSettings/Settings.cs Introduced the AlwaysRunAsAdministrator setting property.

@Jack251970 Jack251970 requested a review from Copilot May 22, 2025 14:18

This comment has been minimized.

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Adds support for always running Flow Launcher as administrator by extending startup configuration, command execution, and UI.

  • Introduces a UAC confirmation dialog for elevated launches when already running as admin.
  • Updates Win32 and UWP launch paths to handle elevated/non-elevated scenarios, including “Always Run As Administrator” toggle.
  • Extends settings UI and auto-startup helper to configure logon task run level and prompt for restart on admin-mode changes.

Reviewed Changes

Copilot reviewed 17 out of 17 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
Plugins/Flow.Launcher.Plugin.Program/UACDialog.xaml(.cs) New modal dialog for UAC confirmation when launching elevated
Plugins/Flow.Launcher.Plugin.Program/Programs/Win32.cs Refactored launch logic, added elevated flag
Plugins/Flow.Launcher.Plugin.Program/Programs/UWPPackage.cs Updated UWP launch with elevated support
Flow.Launcher/SettingPages/Views/SettingsPaneGeneral.xaml Added toggle for “Always run as administrator”
Flow.Launcher/SettingPages/ViewModels/SettingsPaneGeneralViewModel.cs Handles new setting, prompts restart
Flow.Launcher/Helper/AutoStartup.cs Propagates new flag to logon task configuration
Flow.Launcher/PublicAPIInstance.cs Added overload to RestartApp with arguments
Flow.Launcher/MainWindow.xaml.cs Displays “(Admin)” in tray icon text when elevated
Flow.Launcher.Infrastructure/Win32Helper.cs Exposes IsAdministrator helper
Flow.Launcher.Infrastructure/UserSettings/Settings.cs New AlwaysRunAsAdministrator setting
Comments suppressed due to low confidence (2)

Flow.Launcher/MainWindow.xaml.cs:598

  • [nitpick] Variable name 'text' is too generic; consider renaming to 'notifyIconText' or similar to clarify its purpose.
var text = Win32Helper.IsAdministrator() ?

Flow.Launcher/PublicAPIInstance.cs:93

  • Verify that UpdateManager.RestartApp supports an overload with arguments; if not, this call will fail at runtime or cause a breaking change in the public API.
UpdateManager.RestartApp(Constant.ApplicationFileName, arguments);

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

♻️ Duplicate comments (4)
Flow.Launcher.Command/Program.cs (4)

40-44: ⚠️ Potential issue

-Arguments still fails when no value follows

The earlier review pointed out that if -Arguments is the last token, isArguments is set to true without adding any argument, leading to confusing behaviour. The guard is still missing.

-                    case "-Arguments":
-                        if (i + 1 < args.Length)
-                            argumentList.Add(args[++i]);
-                        isArguments = true;
+                    case "-Arguments":
+                        if (i + 1 < args.Length)
+                        {
+                            argumentList.Add(args[++i]);
+                            isArguments = true;
+                        }
+                        else
+                        {
+                            Console.WriteLine("Error: -Arguments expects at least one value.");
+                            return -2;
+                        }

52-56: ⚠️ Potential issue

Verb runas requires UseShellExecute = true

Process.Start will throw InvalidOperationException when Verb is set while UseShellExecute is false. Add a guard after parsing to prevent the invalid combination or auto-set UseShellExecute = true.


106-118: ⚠️ Potential issue

ArgumentList cannot be used with UseShellExecute = true

If callers supply multiple arguments while leaving -UseShellExecute at its default true, this block will throw before your catch.
Adopt the earlier suggestion: when useShellExecute is true, concatenate the arguments into a single string and assign it to info.Arguments; only use ArgumentList when false.


119-121: 🛠️ Refactor suggestion

Disposing the Process object immediately denies callers access to the handle

Process.Start(info)?.Dispose(); closes the handle right after launch, preventing plugins from waiting on the process or reading its exit code. Either return the Process object to the caller or omit disposal.

🧹 Nitpick comments (1)
Flow.Launcher.Command/Program.cs (1)

58-61: -CreateNoWindow parsing forgets to reset isArguments

Unlike the other switch arms, this case leaves isArguments unchanged. If -CreateNoWindow appears after -Arguments, subsequent tokens are still treated as arguments unintentionally. Add isArguments = false; after setting the flag.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7ea76b8 and 721bb98.

📒 Files selected for processing (1)
  • Flow.Launcher.Command/Program.cs (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: build
  • GitHub Check: Check Spelling
🔇 Additional comments (1)
Flow.Launcher.Command/Program.cs (1)

1-3: Missing explicit using System.Collections.Generic;

List<string> relies on the implicit-usings feature. To keep the file self-contained and to support projects where implicit usings are disabled, add the directive:

using System.Collections.Generic;

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Adds support for always running Flow Launcher as administrator by introducing a new setting, updating startup task logic, and providing a CLI helper for launching processes with appropriate privileges.

  • Introduces AlwaysRunAsAdministrator setting and UI controls
  • Extends AutoStartup and Win32Helper to handle elevated logon tasks and de‐elevation
  • Adds a new Flow.Launcher.Command project and StartProcess APIs to launch subprocesses under different privilege levels

Reviewed Changes

Copilot reviewed 31 out of 31 changed files in this pull request and generated no comments.

Show a summary per file
File Description
SettingPages/ViewModels/SettingsPaneGeneralViewModel.cs Added AlwaysRunAsAdministrator property and restart prompts
Resources/Pages/WelcomePage5.xaml.cs Passed AlwaysRunAsAdministrator into startup logic
PublicAPIInstance.cs Added StartProcess methods and refactored restart and shell run
MainWindow.xaml.cs Updated tray icon text to show “(Admin)” when elevated
Languages/en.xaml Added localization keys for new admin options and dialogs
Helper/AutoStartup.cs Changed task scheduling to respect admin run level
Infrastructure/Win32Helper.cs Added IsAdministrator and RunAsDesktopUser helpers
Infrastructure/Constant.cs Introduced CommandExecutablePath for the external helper binary
Flow.Launcher.Command/… New CLI project for -StartProcess helper
App.xaml.cs Checks and restarts app as admin if needed on startup
Comments suppressed due to low confidence (3)

Flow.Launcher/PublicAPIInstance.cs:651

  • JoinArgumentList uses LINQ's Select but using System.Linq; is not imported. Please add the namespace to avoid a compile error.
private static string JoinArgumentList(Collection<string> args)

Flow.Launcher.Infrastructure/Constant.cs:19

  • The CommandExecutablePath may not exist in the main output folder by default. Ensure the Flow.Launcher.Command.exe is copied into a Command subfolder of your build output (e.g. with a post-build event or MSBuild <Copy> task).
public static readonly string CommandExecutablePath = Path.Combine(ProgramDirectory, "Command", "Flow.Launcher.Command.exe");

Flow.Launcher/Helper/AutoStartup.cs:151

  • [nitpick] Consider unscheduling any existing task before scheduling a new one to prevent duplicate or outdated logon tasks, e.g. call UnscheduleLogonTask() if CheckLogonTask() finds an existing entry.
public static void ChangeToViaLogonTask(bool alwaysRunAsAdministrator)

This comment has been minimized.

@Jack251970 Jack251970 modified the milestones: Future, 2.0.0 Jun 15, 2025

This comment has been minimized.

This comment has been minimized.

This comment has been minimized.

This comment has been minimized.

@jjw24 jjw24 added the review in progress Indicates that a review is in progress for this PR label Jun 17, 2025
@jjw24
Copy link
Member

jjw24 commented Jun 18, 2025

@coderabbitai full review

Copy link
Contributor

coderabbitai bot commented Jun 18, 2025

✅ Actions performed

Full review triggered.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 4

♻️ Duplicate comments (11)
Flow.Launcher.Infrastructure/Http/Http.cs (1)

231-234: Swallowed exception still unlogged – original concern remains
The earlier review already highlighted that silently returning an empty string hides real failures. The latest edit just removes the unused variable but keeps the silent catch.

Flow.Launcher/MainWindow.xaml.cs (1)

698-698: NotifyIcon.Text length limit
Windows restricts NotifyIcon.Text to ~63 characters; consider trimming or sanitizing the translation to avoid runtime exceptions if the combined string is too long.

Flow.Launcher.Infrastructure/NativeMethods.txt (1)

77-78: Duplicate P/Invoke declarations – please consolidate
GetShellWindow / GetWindowThreadProcessId are already declared earlier (lines 28 & 55). Keeping two copies risks drift.

The earlier feedback on the same duplication still applies.

Flow.Launcher.Command/Program.cs (4)

41-45: -Arguments flag still accepts “nothing” silently.

If -Arguments is the last token, isArguments is set to true but no argument is added, yielding confusing behaviour.
This was pointed out previously and remains unfixed.


46-49: Verb without UseShellExecute=true will crash at runtime.

ProcessStartInfo.Verb requires UseShellExecute. Guard against the invalid combination or flip useShellExecute automatically.


105-118: ArgumentList + UseShellExecute=true throws InvalidOperationException.

ArgumentList can only be used when UseShellExecute is false. Concatenate into Arguments when shell execution is requested.


119-121: Disposing the Process object immediately loses the handle.

using/Dispose() right after Start() closes the handle and prevents callers from later waiting or querying exit code.

Plugins/Flow.Launcher.Plugin.Shell/Main.cs (1)

330-339: StartProcess loses argument quoting & relies on case-sensitive 'runas'

  1. string.Join(" ", info.ArgumentList) flattens the list and drops the quoting/escaping that ProcessStartInfo would have preserved. Any argument containing spaces (e.g. a path under Program Files) will be split into multiple tokens.

  2. info.Verb == "runas" performs a case-sensitive comparison; ProcessStartInfo.Verb is documented as case-insensitive. Use Equals(..., OrdinalIgnoreCase).

  3. The method returns null, changing the contract of the delegate previously supplied to ShellCommand.Execute. Verify that Execute never dereferences the returned Process, otherwise this will produce NullReferenceExceptions.

-Context.API.StartProcess(info.FileName, info.WorkingDirectory, string.Join(" ", info.ArgumentList), info.Verb == "runas");
+var arguments = string.Join(" ", info.ArgumentList.Select(arg =>
+    arg.Contains(' ') ? $"\"{arg}\"" : arg));
+var elevate = info.Verb?.Equals("runas", StringComparison.OrdinalIgnoreCase) ?? false;
+Context.API.StartProcess(info.FileName, info.WorkingDirectory, arguments, elevate);

Optionally extend PublicAPI.StartProcess to accept ProcessStartInfo directly, eliminating manual string handling.

Flow.Launcher/App.xaml.cs (2)

59-64: Handle UAC-cancel gracefully to avoid a crash / restart loop

RestartApp(true) will throw a Win32Exception (NativeErrorCode == 1223) when the user cancels the elevation prompt.
Because the call sits inside the constructor before DI is ready, the exception bubbles out and Flow exits – and on next launch we hit the same branch again → infinite loop.

Wrap the restart call in a try/catch that:

  1. Detects a cancelled UAC (Win32Exception with error code 1223)
  2. Logs the event
  3. Continues startup without elevation (or disables AlwaysRunAsAdministrator)
-            if (_settings.AlwaysRunAsAdministrator && !Win32Helper.IsAdministrator())
-            {
-                RestartApp(true);
-                return;
-            }
+            if (_settings.AlwaysRunAsAdministrator && !Win32Helper.IsAdministrator())
+            {
+                try
+                {
+                    RestartApp(true);
+                    return;
+                }
+                catch (System.ComponentModel.Win32Exception ex) when (ex.NativeErrorCode == 1223)
+                {
+                    // User cancelled UAC prompt - disable setting to prevent loop
+                    _settings.AlwaysRunAsAdministrator = false;
+                    _settings.Save();
+                }
+            }

381-381: Quote the executable path to survive spaces

Constant.ExecutablePath is concatenated directly into the argument string.
If Flow Launcher lives under "Program Files" (or any path with spaces), update.exe will receive a truncated argument and the restart will silently fail.

-                Arguments = $"--processStartAndWait {Constant.ExecutablePath}",
+                Arguments = $"--processStartAndWait \"{Constant.ExecutablePath}\"",
Flow.Launcher/PublicAPIInstance.cs (1)

593-615: Missing error handling when RunAsDesktopUser returns false but errorInfo is empty

RunAsDesktopUser can legitimately fail and still leave errorInfo blank (e.g., unexpected exit code).
At the moment we only log when errorInfo has content, meaning silent failures slip through, the method then reports success (true) to callers, and upstream logic proceeds on a false premise.

Diff to ensure every failure path is surfaced and the method never returns a false-positive:

- var result = Win32Helper.RunAsDesktopUser(
+ var result = Win32Helper.RunAsDesktopUser(
     Constant.CommandExecutablePath,
     Environment.CurrentDirectory,
     $"-StartProcess " +
     $"-FileName {AddDoubleQuotes(fileName)} " +
     $"-WorkingDirectory {AddDoubleQuotes(workingDirectory)} " +
     $"-Arguments {AddDoubleQuotes(arguments)} " +
     $"-UseShellExecute {useShellExecute} " +
     $"-Verb {AddDoubleQuotes(verb)} " +
     $"-CreateNoWindow {createNoWindow}",
     false,
     true, // Do not show the command window
     out var errorInfo);
- if (!string.IsNullOrEmpty(errorInfo))
- {
-     LogError(ClassName, $"Failed to start process {fileName} with arguments {arguments} under {workingDirectory}: {errorInfo}");
- }
-
- return result;
+ if (!result)
+ {
+     // Provide best-effort diagnostic information
+     var extra = string.IsNullOrEmpty(errorInfo) ? string.Empty : $": {errorInfo}";
+     LogError(ClassName,
+         $"Failed to start process {fileName} with arguments {arguments} under {workingDirectory}{extra}");
+ }
+
+ return result;
🧹 Nitpick comments (10)
Flow.Launcher/Flow.Launcher.csproj (1)

146-152: Build helper via ProjectReference instead of an extra target

Invoking MSBuild manually works but:
• duplicates configuration logic
• slows incremental builds (always builds after Build)
• risks drifting properties.

Prefer adding the Command project as a normal <ProjectReference> with OutputItemType=Content/CopyToOutputDirectory, letting the default build graph handle it.

-  <Target Name="BuildCommandProject" AfterTargets="Build">
-    <MSBuild
-      Projects="..\Flow.Launcher.Command\Flow.Launcher.Command.csproj"
-      Targets="Build"
-      BuildInParallel="false"
-      Properties="Platform=$(Platform);Configuration=$(Configuration)" />
-  </Target>
+
+  <ItemGroup>
+    <ProjectReference Include="..\Flow.Launcher.Command\Flow.Launcher.Command.csproj" />
+  </ItemGroup>
Plugins/Flow.Launcher.Plugin.WindowsSettings/Helper/ResultHelper.cs (1)

199-205: Minor comment style nit

Duplicate comments with differing capitalisation (“windows settings”) slightly clutter the try/catch.
One concise comment once is enough and keeps the block tidy.

-                // No need to de-elevate since we are opening windows settings which cannot bring security risks
+                // No need to de-elevate; opening Windows Settings is safe

Also applies to: 209-213

Flow.Launcher.Command/Properties/PublishProfiles/Net7.0-SelfContained.pubxml (1)

1-18: Publish profile for self-contained .NET 7 utility
Configuration correctly targets net7.0-windows with win-x64 and embeds the runtime. If you prefer a single-file executable for simpler deployment, set <PublishSingleFile>true</PublishSingleFile>, noting the trade-offs in size and startup time.

Flow.Launcher/SettingPages/Views/SettingsPaneGeneral.xaml (1)

46-68: UI Grouping Consistency
The new StackPanel wraps two cc:Card controls to expose both toggles, but other sections use cc:CardGroup or consistent spacing patterns. Consider replacing the StackPanel with a cc:CardGroup (or adding consistent margins) to align with the layout of adjacent controls and maintain uniform spacing across settings cards.

Flow.Launcher/Languages/en.xaml (1)

137-140: Refine restart prompt wording
The prompt text is a bit awkward. Consider rephrasing for clarity, e.g.:
“Would you like to restart Flow Launcher as administrator to apply this change? You can also run as administrator manually on next startup.”

Plugins/Flow.Launcher.Plugin.Program/Programs/UWPPackage.cs (1)

455-458: Handle exceptions in async launch
Currently Launch schedules a fire-and-forget Task.Run without catching failures from StartProcess. To avoid silent failures, wrap the call in a try/catch or add a continuation to log any exceptions.

Example diff:

-            _ = Task.Run(() => Main.Context.API.StartProcess(
+            _ = Task.Run(() =>
+            {
+                try
+                {
+                    Main.Context.API.StartProcess(
+                        command,
+                        arguments: string.Empty,
+                        useShellExecute: true,
+                        verb: elevated ? "runas" : "");
+                }
+                catch (Exception ex)
+                {
+                    ProgramLogger.LogException(
+                        "UWP", "Launch", $"{UserModelId}", ex);
+                }
+            });

This ensures unexpected errors during StartProcess are captured and logged.

Flow.Launcher.Command/Flow.Launcher.Command.csproj (1)

24-24: UseVSHostingProcess is obsolete in SDK-style projects.

UseVSHostingProcess was only relevant for the old .NET Framework debugging host.
On modern SDK-style projects targeting .NET 7 it is ignored and clutters the file.

-    <UseVSHostingProcess>true</UseVSHostingProcess>
Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs (2)

241-245: Typo: “spefic” → “specific”.

-        /// Http download the spefic url and return as string
+        /// Http download the specific URL and return it as a string

405-407: Typo: “requerying” should be hyphenated.

-        /// This method will go back to query results before requerying.
+        /// This method will go back to the query results before re-querying.
Flow.Launcher/PublicAPIInstance.cs (1)

639-664: Quotation helper does not escape embedded quotes / special characters

AddDoubleQuotes blindly wraps the argument, which breaks when the argument itself already contains double-quotes or backslashes (common with paths containing "&" or when users manually quote).
Consider leveraging CommandLineBuilder (available since .NET 7) or porting a minimal escape routine that follows Windows command-line parsing rules to avoid injection or malformed command lines.

This is a low-effort improvement now that process launching has become security-sensitive.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3688837 and 48ed897.

⛔ Files ignored due to path filters (1)
  • Flow.Launcher.Command/app.ico is excluded by !**/*.ico
📒 Files selected for processing (30)
  • Flow.Launcher.Command/Flow.Launcher.Command.csproj (1 hunks)
  • Flow.Launcher.Command/Program.cs (1 hunks)
  • Flow.Launcher.Command/Properties/PublishProfiles/Net7.0-SelfContained.pubxml (1 hunks)
  • Flow.Launcher.Core/Configuration/Portable.cs (2 hunks)
  • Flow.Launcher.Core/Updater.cs (2 hunks)
  • Flow.Launcher.Infrastructure/Constant.cs (1 hunks)
  • Flow.Launcher.Infrastructure/Http/Http.cs (1 hunks)
  • Flow.Launcher.Infrastructure/NativeMethods.txt (1 hunks)
  • Flow.Launcher.Infrastructure/UserSettings/Settings.cs (1 hunks)
  • Flow.Launcher.Infrastructure/Win32Helper.cs (5 hunks)
  • Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs (3 hunks)
  • Flow.Launcher.sln (3 hunks)
  • Flow.Launcher/App.xaml.cs (4 hunks)
  • Flow.Launcher/Flow.Launcher.csproj (1 hunks)
  • Flow.Launcher/Helper/AutoStartup.cs (7 hunks)
  • Flow.Launcher/Languages/en.xaml (2 hunks)
  • Flow.Launcher/MainWindow.xaml.cs (1 hunks)
  • Flow.Launcher/PublicAPIInstance.cs (7 hunks)
  • Flow.Launcher/Resources/Pages/WelcomePage5.xaml.cs (1 hunks)
  • Flow.Launcher/SettingPages/ViewModels/SettingsPaneGeneralViewModel.cs (8 hunks)
  • Flow.Launcher/SettingPages/Views/SettingsPaneGeneral.xaml (1 hunks)
  • Plugins/Flow.Launcher.Plugin.Explorer/ContextMenu.cs (4 hunks)
  • Plugins/Flow.Launcher.Plugin.Explorer/Search/Everything/EverythingSearchManager.cs (1 hunks)
  • Plugins/Flow.Launcher.Plugin.Explorer/ViewModels/SettingsViewModel.cs (1 hunks)
  • Plugins/Flow.Launcher.Plugin.Program/Programs/UWPPackage.cs (4 hunks)
  • Plugins/Flow.Launcher.Plugin.Program/Programs/Win32.cs (4 hunks)
  • Plugins/Flow.Launcher.Plugin.Shell/Languages/en.xaml (1 hunks)
  • Plugins/Flow.Launcher.Plugin.Shell/Main.cs (9 hunks)
  • Plugins/Flow.Launcher.Plugin.Sys/Main.cs (5 hunks)
  • Plugins/Flow.Launcher.Plugin.WindowsSettings/Helper/ResultHelper.cs (2 hunks)
🧰 Additional context used
🧠 Learnings (2)
Flow.Launcher/MainWindow.xaml.cs (2)
Learnt from: Jack251970
PR: Flow-Launcher/Flow.Launcher#3672
File: Flow.Launcher/MainWindow.xaml.cs:318-318
Timestamp: 2025-06-08T14:12:12.842Z
Learning: In Flow.Launcher, the App.NotifyIcon static property is initialized in the App class before MainWindow creation, so null checks are not needed when accessing App.NotifyIcon in MainWindow lifecycle methods.
Learnt from: Jack251970
PR: Flow-Launcher/Flow.Launcher#3672
File: Flow.Launcher/MainWindow.xaml.cs:244-247
Timestamp: 2025-06-08T14:12:21.348Z
Learning: In Flow.Launcher, App.NotifyIcon is created before MainWindow creation, so null checks for App.NotifyIcon are not necessary when accessing it from MainWindow code.
Flow.Launcher/Flow.Launcher.csproj (1)
Learnt from: taooceros
PR: Flow-Launcher/Flow.Launcher#2616
File: Flow.Launcher/Flow.Launcher.csproj:7-7
Timestamp: 2024-10-08T15:52:58.573Z
Learning: In the Flow Launcher project, the version number in the `Flow.Launcher.csproj` file is dynamically updated during the CI/CD process.
🪛 GitHub Actions: Check Spelling
Flow.Launcher.Infrastructure/Http/Http.cs

[warning] 81-20: Spell check: 'Ioc' is not a recognized word. (unrecognized-spelling)


[warning] 210-25: Spell check: 'Asynchrously' is not a recognized word. (unrecognized-spelling)

Flow.Launcher.Core/Configuration/Portable.cs

[warning] 65-52: Spell check: 'uninstaller' is not a recognized word. (unrecognized-spelling)


[warning] 68-34: Spell check: 'Uninstaller' is not a recognized word. (unrecognized-spelling)


[warning] 91-38: Spell check: 'Uninstaller' is not a recognized word. (unrecognized-spelling)


[warning] 94-49: Spell check: 'Uninstaller' is not a recognized word. (unrecognized-spelling)


[warning] 116-38: Spell check: 'Uninstaller' is not a recognized word. (unrecognized-spelling)


[warning] 133-63: Spell check: 'Todelete' is not a recognized word. (unrecognized-spelling)


[warning] 173-76: Spell check: 'uninstaller' is not a recognized word. (unrecognized-spelling)

Flow.Launcher.Infrastructure/UserSettings/Settings.cs

[warning] 28-67: Spell check: 'Ioc' is not a recognized word. (unrecognized-spelling)


[warning] 29-33: Spell check: 'Ioc' is not a recognized word. (unrecognized-spelling)

Plugins/Flow.Launcher.Plugin.Explorer/ViewModels/SettingsViewModel.cs

[warning] 276-55: Spell check: 'actionkeywordview' is not a recognized word. (unrecognized-spelling)


[warning] 278-55: Spell check: 'actionkeywordview' is not a recognized word. (unrecognized-spelling)


[warning] 280-55: Spell check: 'actionkeywordview' is not a recognized word. (unrecognized-spelling)


[warning] 282-55: Spell check: 'actionkeywordview' is not a recognized word. (unrecognized-spelling)


[warning] 282-67: Spell check: 'quickaccess' is not a recognized word. (unrecognized-spelling)

Flow.Launcher/MainWindow.xaml.cs

[warning] 61-46: Spell check: 'WMP' is not a recognized word. (unrecognized-spelling)


[warning] 102-31: Spell check: 'VSTHRD' is not a recognized word. (unrecognized-spelling)


[warning] 486-31: Spell check: 'VSTHRD' is not a recognized word. (unrecognized-spelling)


[warning] 549-31: Spell check: 'VSTHRD' is not a recognized word. (unrecognized-spelling)


[warning] 658-30: Spell check: 'WMP' is not a recognized word. (unrecognized-spelling)


[warning] 660-34: Spell check: 'WMP' is not a recognized word. (unrecognized-spelling)


[warning] 746-25: Spell check: 'gamemode' is not a recognized word. (unrecognized-spelling)


[warning] 747-25: Spell check: 'gamemode' is not a recognized word. (unrecognized-spelling)


[warning] 750-32: Spell check: 'gamemode' is not a recognized word. (unrecognized-spelling)


[warning] 753-30: Spell check: 'positionreset' is not a recognized word. (unrecognized-spelling)


[warning] 756-37: Spell check: 'positionreset' is not a recognized word. (unrecognized-spelling)


[warning] 772-21: Spell check: 'gamemode' is not a recognized word. (unrecognized-spelling)


[warning] 773-26: Spell check: 'positionreset' is not a recognized word. (unrecognized-spelling)


[warning] 778-26: Spell check: 'positionreset' is not a recognized word. (unrecognized-spelling)


[warning] 888-64: Spell check: 'XRatio' is not a recognized word. (unrecognized-spelling)


[warning] 889-63: Spell check: 'YRatio' is not a recognized word. (unrecognized-spelling)


[warning] 1103-20: Spell check: 'clocksb' is not a recognized word. (unrecognized-spelling)


[warning] 1104-20: Spell check: 'clocksb' is not a recognized word. (unrecognized-spelling)


[warning] 1105-19: Spell check: 'iconsb' is not a recognized word. (unrecognized-spelling)


[warning] 1106-19: Spell check: 'iconsb' is not a recognized word. (unrecognized-spelling)


[warning] 1111-20: Spell check: 'clocksb' is not a recognized word. (unrecognized-spelling)


[warning] 1112-19: Spell check: 'iconsb' is not a recognized word. (unrecognized-spelling)

Plugins/Flow.Launcher.Plugin.Sys/Main.cs

[warning] 317-51: Spell check: 'indexoption' is not a recognized word. (unrecognized-spelling)


[warning] 353-54: Spell check: 'openrecyclebin' is not a recognized word. (unrecognized-spelling)


[warning] 383-107: Spell check: 'dlgtitle' is not a recognized word. (unrecognized-spelling)


[warning] 422-94: Spell check: 'dlgtitle' is not a recognized word. (unrecognized-spelling)

Plugins/Flow.Launcher.Plugin.Explorer/ContextMenu.cs

[warning] 73-98: Spell check: 'quickaccess' is not a recognized word. (unrecognized-spelling)


[warning] 84-101: Spell check: 'addfilefoldersuccess' is not a recognized word. (unrecognized-spelling)


[warning] 92-95: Spell check: 'contextmenu' is not a recognized word. (unrecognized-spelling)


[warning] 92-108: Spell check: 'titletooltip' is not a recognized word. (unrecognized-spelling)


[warning] 101-100: Spell check: 'quickaccess' is not a recognized word. (unrecognized-spelling)


[warning] 102-103: Spell check: 'quickaccess' is not a recognized word. (unrecognized-spelling)


[warning] 108-104: Spell check: 'removefilefoldersuccess' is not a recognized word. (unrecognized-spelling)


[warning] 115-98: Spell check: 'contextmenu' is not a recognized word. (unrecognized-spelling)


[warning] 115-118: Spell check: 'titletooltip' is not a recognized word. (unrecognized-spelling)


[warning] 116-95: Spell check: 'contextmenu' is not a recognized word. (unrecognized-spelling)


[warning] 116-115: Spell check: 'titletooltip' is not a recognized word. (unrecognized-spelling)


[warning] 125-84: Spell check: 'copypath' is not a recognized word. (unrecognized-spelling)


[warning] 148-84: Spell check: 'copyname' is not a recognized word. (unrecognized-spelling)


[warning] 204-101: Spell check: 'deletefilefolder' is not a recognized word. (unrecognized-spelling)


[warning] 218-122: Spell check: 'deletefilefoldersuccess' is not a recognized word. (unrecognized-spelling)


[warning] 240-93: Spell check: 'contextmenu' is not a recognized word. (unrecognized-spelling)


[warning] 259-98: Spell check: 'runasdifferentuser' is not a recognized word. (unrecognized-spelling)


[warning] 328-92: Spell check: 'opencontainingfolder' is not a recognized word. (unrecognized-spelling)


[warning] 366-101: Spell check: 'openwitheditor' is not a recognized word. (unrecognized-spelling)


[warning] 396-100: Spell check: 'openwithshell' is not a recognized word. (unrecognized-spelling)


[warning] 444-91: Spell check: 'openindexingoptions' is not a recognized word. (unrecognized-spelling)


[warning] 462-102: Spell check: 'openindexingoptions' is not a recognized word. (unrecognized-spelling)


[warning] 478-80: Spell check: 'openwith' is not a recognized word. (unrecognized-spelling)

Plugins/Flow.Launcher.Plugin.Program/Programs/UWPPackage.cs

[warning] 90-103: Spell check: 'uap' is not a recognized word. (unrecognized-spelling)


[warning] 93-55: Spell check: 'rescap' is not a recognized word. (unrecognized-spelling)


[warning] 531-44: Spell check: 'uap' is not a recognized word. (unrecognized-spelling)

Flow.Launcher.Command/Program.cs

[warning] 34-35: Spell check: 'orking' is not a recognized word. (unrecognized-spelling)

Flow.Launcher.Infrastructure/Win32Helper.cs

[warning] 20-33: Spell check: 'Dwm' is not a recognized word. (unrecognized-spelling)


[warning] 46-31: Spell check: 'Dwm' is not a recognized word. (unrecognized-spelling)


[warning] 57-60: Spell check: 'SYSTEMBACKDROP' is not a recognized word. (unrecognized-spelling)


[warning] 58-69: Spell check: 'DWMSBT' is not a recognized word. (unrecognized-spelling)


[warning] 58-57: Spell check: 'SYSTEMBACKDROP' is not a recognized word. (unrecognized-spelling)


[warning] 59-72: Spell check: 'DWMSBT' is not a recognized word. (unrecognized-spelling)


[warning] 59-60: Spell check: 'SYSTEMBACKDROP' is not a recognized word. (unrecognized-spelling)


[warning] 60-52: Spell check: 'DWMSBT' is not a recognized word. (unrecognized-spelling)


[warning] 60-40: Spell check: 'SYSTEMBACKDROP' is not a recognized word. (unrecognized-spelling)


[warning] 63-31: Spell check: 'Dwm' is not a recognized word. (unrecognized-spelling)


[warning] 63-27: Spell check: 'PInvoke' is not a recognized word. (unrecognized-spelling)


[warning] 65-41: Spell check: 'DWMWA' is not a recognized word. (unrecognized-spelling)


[warning] 65-35: Spell check: 'DWMWINDOWATTRIBUTE' is not a recognized word. (unrecognized-spelling)


[warning] 74-31: Spell check: 'Dwm' is not a recognized word. (unrecognized-spelling)


[warning] 74-27: Spell check: 'PInvoke' is not a recognized word. (unrecognized-spelling)


[warning] 76-41: Spell check: 'DWMWA' is not a recognized word. (unrecognized-spelling)


[warning] 76-35: Spell check: 'DWMWINDOWATTRIBUTE' is not a recognized word. (unrecognized-spelling)


[warning] 92-63: Spell check: 'DWMWCP' is not a recognized word. (unrecognized-spelling)


[warning] 93-68: Spell check: 'DWMWCP' is not a recognized word. (unrecognized-spelling)


[warning] 94-65: Spell check: 'DWMWCP' is not a recognized word. (unrecognized-spelling)


[warning] 98-27: Spell check: 'PInvoke' is not a recognized word. (unrecognized-spelling)


[warning] 100-41: Spell check: 'DWMWA' is not a recognized word. (unrecognized-spelling)


[warning] 100-35: Spell check: 'DWMWINDOWATTRIBUTE' is not a recognized word. (unrecognized-spelling)


[warning] 111-60: Spell check: 'PInvoke' is not a recognized word. (unrecognized-spelling)


[warning] 166-59: Spell check: 'GWL' is not a recognized word. (unrecognized-spelling)


[warning] 177-73: Spell check: 'GWL' is not a recognized word. (unrecognized-spelling)


[warning] 182-78: Spell check: 'GWL' is not a recognized word. (unrecognized-spelling)


[warning] 193-71: Spell check: 'GWL' is not a recognized word. (unrecognized-spelling)


[warning] 202-54: Spell check: 'Wnd' is not a recognized word. (unrecognized-spelling)


[warning] 210-53: Spell check: 'Wnd' is not a recognized word. (unrecognized-spelling)


[warning] 214-55: Spell check: 'Wnd' is not a recognized word. (unrecognized-spelling)


[warning] 243-21: Spell check: 'Wnd' is not a recognized word. (unrecognized-spelling)


[warning] 267-51: Spell check: 'WINTAB' is not a recognized word. (unrecognized-spelling)


[warning] 280-36: Spell check: 'Progman' is not a recognized word. (unrecognized-spelling)


[warning] 281-76: Spell check: 'WORKERW' is not a recognized word. (unrecognized-spelling)


[warning] 526-39: Spell check: 'hkl' is not a recognized word. (unrecognized-spelling)


[warning] 532-31: Spell check: 'hkl' is not a recognized word. (unrecognized-spelling)


[warning] 558-35: Spell check: 'nqo' is not a recognized word. (unrecognized-spelling)


[warning] 631-73: Spell check: 'tsf' is not a recognized word. (unrecognized-spelling)


[warning] 654-69: Spell check: 'tsf' is not a recognized word. (unrecognized-spelling)


[warning] 654-73: Spell check: 'tsf' is not a recognized word. (unrecognized-spelling)


[warning] 655-44: Spell check: 'Tsf' is not a recognized word. (unrecognized-spelling)


[warning] 692-26: Spell check: 'Noto' is not a recognized word. (unrecognized-spelling)


[warning] 693-26: Spell check: 'Noto' is not a recognized word. (unrecognized-spelling)


[warning] 694-29: Spell check: 'Noto' is not a recognized word. (unrecognized-spelling)


[warning] 695-29: Spell check: 'Noto' is not a recognized word. (unrecognized-spelling)


[warning] 736-106: Spell check: 'noto' is not a recognized word. (unrecognized-spelling)


[warning] 739-83: Spell check: 'noto' is not a recognized word. (unrecognized-spelling)


[warning] 741-40: Spell check: 'noto' is not a recognized word. (unrecognized-spelling)


[warning] 761-75: Spell check: 'noto' is not a recognized word. (unrecognized-spelling)

Flow.Launcher/App.xaml.cs

[warning] 67-26: Spell check: 'WMP' is not a recognized word. (unrecognized-spelling)


[warning] 104-20: Spell check: 'Ioc' is not a recognized word. (unrecognized-spelling)


[warning] 225-38: Spell check: 'Loadertask' is not a recognized word. (unrecognized-spelling)


[warning] 251-31: Spell check: 'VSTHRD' is not a recognized word. (unrecognized-spelling)

Flow.Launcher/PublicAPIInstance.cs

[warning] 601-35: Spell check: 'orking' is not a recognized word. (unrecognized-spelling)

Plugins/Flow.Launcher.Plugin.Shell/Main.cs

[warning] 48-47: Spell check: 'excmd' is not a recognized word. (unrecognized-spelling)


[warning] 50-40: Spell check: 'excmd' is not a recognized word. (unrecognized-spelling)


[warning] 53-74: Spell check: 'excmd' is not a recognized word. (unrecognized-spelling)


[warning] 55-62: Spell check: 'excmd' is not a recognized word. (unrecognized-spelling)


[warning] 132-67: Spell check: 'CMDs' is not a recognized word. (unrecognized-spelling)


[warning] 184-47: Spell check: 'CMDs' is not a recognized word. (unrecognized-spelling)


[warning] 185-67: Spell check: 'CMDs' is not a recognized word. (unrecognized-spelling)


[warning] 274-50: Spell check: 'pwsh' is not a recognized word. (unrecognized-spelling)


[warning] 403-33: Spell check: 'RStroked' is not a recognized word. (unrecognized-spelling)


[warning] 407-71: Spell check: 'RStroked' is not a recognized word. (unrecognized-spelling)


[warning] 409-33: Spell check: 'RStroked' is not a recognized word. (unrecognized-spelling)


[warning] 417-42: Spell check: 'RPressed' is not a recognized word. (unrecognized-spelling)

Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs

[warning] 249-37: Spell check: 'spefic' is not a recognized word. (unrecognized-spelling)


[warning] 405-118: Spell check: 'requerying' is not a recognized word. (unrecognized-spelling)

⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: gitStream.cm
🔇 Additional comments (24)
Plugins/Flow.Launcher.Plugin.Shell/Languages/en.xaml (1)

1-20: No functional change detected – nothing to review.
The diff only reformats the XML; resource keys and values remain intact.

Flow.Launcher.Core/Configuration/Portable.cs (1)

51-52: 👍 Migrated to API.RestartApp() – looks correct
Switching to the new helper aligns portable-mode restarts with the unified restart/elevation pipeline.

Also applies to: 75-76

Flow.Launcher.Infrastructure/UserSettings/Settings.cs (1)

395-396: Consider triggering a restart or privilege check when AlwaysRunAsAdministrator changes
Adding the setting is fine, but changing it at runtime won’t have any effect until the app restarts elevated/unelevated. Make sure the UI layer prompts for restart or automatically calls API.RestartApp() when this property toggles.

Plugins/Flow.Launcher.Plugin.Explorer/Search/Everything/EverythingSearchManager.cs (1)

59-62: Centralised process launch looks good

Replacing the raw Process.Start with Main.Context.API.StartProcess is exactly what we need now that elevation handling is centralised.
Nothing else to flag here.

Flow.Launcher/Resources/Pages/WelcomePage5.xaml.cs (1)

48-49: Confirm all call-sites updated for new parameter

AutoStartup.ChangeToViaLogonTask now takes the runAsAdmin flag.
Please double-check other call-sites (e.g. Settings page, installer routines) to ensure they were also updated, otherwise the logon task may lose elevation state.

Flow.Launcher.Core/Updater.cs (1)

92-92: Use centralized restart API
Switched to _api.RestartApp() to leverage the new instance-based restart logic, ensuring elevation handling is consistent across the app.

Flow.Launcher/MainWindow.xaml.cs (1)

692-694: Indicate administrator status in tray tooltip
The tray icon’s tooltip now dynamically appends the localized “admin” label when running elevated, improving user awareness.

Plugins/Flow.Launcher.Plugin.Sys/Main.cs (5)

213-214: Document skipping de-elevation in Shutdown
The inline comment clearly explains why de-elevation isn’t needed after the confirmation dialog, improving maintainability.


235-236: Document skipping de-elevation in Restart
Good to note that the confirmation prompt eliminates the need to de-elevate before invoking the restart command.


257-258: Document skipping de-elevation in Advanced Boot Options
The comment justifies retaining elevation when launching the advanced reboot sequence, enhancing clarity.


321-322: Document skipping de-elevation for Indexing Options
Explains why opening Windows settings via control.exe doesn’t require de-elevation—solid rationale.


358-359: Document skipping de-elevation for Recycle Bin
Comment concisely clarifies that launching Explorer for the Recycle Bin poses no security risk, so no de-elevation is required.

Plugins/Flow.Launcher.Plugin.Explorer/ContextMenu.cs (4)

361-361: Centralized process launch for editor
Using Context.API.StartProcess here standardizes privilege elevation and removes direct Process.Start calls.


391-391: Centralized process launch for shell
Great to see Context.API.StartProcess applied for shell launches, keeping elevation handling uniform.


456-457: Document skipping de-elevation for indexing settings
The comment clearly states why de-elevation isn't necessary when opening Windows indexing options.


481-482: Document skipping de-elevation for “Open With” dialog
Clarifies that invoking rundll32.exe for the “Open With” dialog carries no security risk, so no de-elevation is needed.

Flow.Launcher.sln (1)

74-75: Verify new project entry
The new Flow.Launcher.Command project is added correctly, but ensure it’s also included in the NestedProjects section if it should belong under a solution folder. Confirm the relative path and GUID match the new project’s .csproj.

Flow.Launcher/Languages/en.xaml (1)

49-49: Add admin suffix resource
The (Admin) label is correctly introduced for UI badges. Ensure that MainWindow’s tooltip binding appends this resource only when IsAdministrator is true.

Plugins/Flow.Launcher.Plugin.Program/Programs/UWPPackage.cs (1)

6-17: The added using directives are all referenced (e.g., Channels in WatchPackageChangeAsync, XML in manifest parsing, Input for key state, etc.).

Flow.Launcher.Infrastructure/Win32Helper.cs (2)

801-806: LGTM!

The IsAdministrator method is implemented correctly with proper resource disposal.


938-943: Handle cleanup properly implemented

The success path now correctly closes all handles, addressing the previous review comment about handle leaks.

Flow.Launcher/App.xaml.cs (1)

267-276: Good error handling for permission issues

The exception handling properly catches permission errors and gives users the option to restart with elevated privileges.

Flow.Launcher/SettingPages/ViewModels/SettingsPaneGeneralViewModel.cs (1)

118-143: ****

Flow.Launcher/Helper/AutoStartup.cs (1)

54-115: Well-structured permission handling

The CheckLogonTask method properly handles different scenarios based on admin privileges:

  • Admins can fix both path and run level mismatches
  • Non-admins can only fix path issues and get appropriate exception for run level changes
  • Proper error propagation for UI handling

Copy link
Member

@jjw24 jjw24 left a comment

Choose a reason for hiding this comment

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

Please see if the additional review comments from coderabbitai are relevant

@Jack251970
Copy link
Member Author

Please see if the additional review comments from coderabbitai are relevant

Done

This comment has been minimized.

This comment has been minimized.

This comment has been minimized.

Copy link

@check-spelling-bot Report

🔴 Please review

See the 📂 files view, the 📜action log, or 📝 job summary for details.

❌ Errors and Warnings Count
❌ forbidden-pattern 2
⚠️ non-alpha-in-dictionary 2

See ❌ Event descriptions for more information.

Forbidden patterns 🙅 (1)

In order to address this, you could change the content to not match the forbidden patterns (comments before forbidden patterns may help explain why they're forbidden), add patterns for acceptable instances, or adjust the forbidden patterns themselves.

These forbidden patterns matched content:

s.b. workaround(s)

\bwork[- ]arounds?\b
If the flagged items are 🤯 false positives

If items relate to a ...

  • binary file (or some other file you wouldn't want to check at all).

    Please add a file path to the excludes.txt file matching the containing file.

    File paths are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your files.

    ^ refers to the file's path from the root of the repository, so ^README\.md$ would exclude README.md (on whichever branch you're using).

  • well-formed pattern.

    If you can write a pattern that would match it,
    try adding it to the patterns.txt file.

    Patterns are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your lines.

    Note that patterns can't match multiline strings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
30 min review enhancement New feature or request review in progress Indicates that a review is in progress for this PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add an Option to always run Flow launcher as Administrator on startup
2 participants