Skip to content

Commit 5366d15

Browse files
CopilotJack251970
andcommitted
Fix: Set Normal process priority for logon startup task
The default priority for Windows Task Scheduler tasks is Low (7), which causes Flow Launcher to be sluggish when other processes are consuming CPU. Explicitly set the task priority to Normal when creating the logon startup task. Also update CheckLogonTask() to recreate the task if the priority is not Normal, so existing users with the incorrect priority get automatically fixed on next startup. Co-authored-by: Jack251970 <53996452+Jack251970@users.noreply.github.com>
1 parent f4ed8ae commit 5366d15

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

Flow.Launcher/Helper/AutoStartup.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,9 @@ private static bool CheckLogonTask()
6464
if (task.Definition.Actions.FirstOrDefault() is Microsoft.Win32.TaskScheduler.Action taskAction)
6565
{
6666
var action = taskAction.ToString().Trim();
67-
if (!action.Equals(Constant.ExecutablePath, StringComparison.OrdinalIgnoreCase))
67+
var needsRecreation = !action.Equals(Constant.ExecutablePath, StringComparison.OrdinalIgnoreCase)
68+
|| task.Definition.Settings.Priority != System.Diagnostics.ProcessPriorityClass.Normal;
69+
if (needsRecreation)
6870
{
6971
UnscheduleLogonTask();
7072
ScheduleLogonTask();
@@ -184,6 +186,7 @@ private static bool ScheduleLogonTask()
184186
td.Settings.StopIfGoingOnBatteries = false;
185187
td.Settings.DisallowStartIfOnBatteries = false;
186188
td.Settings.ExecutionTimeLimit = TimeSpan.Zero;
189+
td.Settings.Priority = System.Diagnostics.ProcessPriorityClass.Normal;
187190

188191
try
189192
{

0 commit comments

Comments
 (0)