[Awake]Don't exit from tray icon unless standalone (#22232)

This commit is contained in:
Jaime Bernardo
2022-11-23 12:12:17 +00:00
committed by GitHub
parent 2074d32cb1
commit 97fdf033c8
2 changed files with 19 additions and 7 deletions

View File

@@ -44,6 +44,8 @@ namespace Awake
private static FileSystemWatcher? _watcher;
private static SettingsUtils? _settingsUtils;
private static bool _startedFromPowerToys;
public static Mutex LockMutex { get => _mutex; set => _mutex = value; }
private static Logger? _log;
@@ -188,6 +190,10 @@ namespace Awake
_log.Info("No PID specified. Allocating console...");
APIHelper.AllocateConsole();
}
else
{
_startedFromPowerToys = true;
}
_log.Info($"The value for --use-pt-config is: {usePtConfig}");
_log.Info($"The value for --display-on is: {displayOn}");
@@ -238,7 +244,7 @@ namespace Awake
.Select(e => e.EventArgs)
.Subscribe(HandleAwakeConfigChange);
TrayHelper.SetTray(InternalConstants.FullAppName, new AwakeSettings());
TrayHelper.SetTray(InternalConstants.FullAppName, new AwakeSettings(), _startedFromPowerToys);
// Initially the file might not be updated, so we need to start processing
// settings right away.
@@ -330,7 +336,7 @@ namespace Awake
}
}
TrayHelper.SetTray(InternalConstants.FullAppName, settings);
TrayHelper.SetTray(InternalConstants.FullAppName, settings, _startedFromPowerToys);
}
else
{