Add macOS Helper
ADD
WalletWasabi.Fluent/Helpers/MacOsStartUpHelper.cs
+using System.Threading.Tasks;
+using WalletWasabi.Helpers;
+
+namespace WalletWasabi.Fluent.Helpers
+{
+ public static class MacOsStartUpHelper
+ {
+ private static readonly string AddCmd = $"osascript -e \' tell application \"System Events\" to make new login item at end with properties {{name:\"{Constants.AppName}\", path:\"/Applications/{Constants.AppName}.app\", hidden:true}} \'";
+ private static readonly string DeleteCmd = $"osascript -e \' tell application \"System Events\" to delete login item \"{Constants.AppName}\" \'";
+
+ public static async Task ModifyLoginItemsAsync(bool runOnSystemStartup)
+ {
+ if (runOnSystemStartup)
+ {
+ await EnvironmentHelpers.ShellExecAsync(AddCmd).ConfigureAwait(false);
+ }
+ else
+ {
+ await EnvironmentHelpers.ShellExecAsync(DeleteCmd).ConfigureAwait(false);
+ }
+ }
+ }
+}

MODIFY
WalletWasabi.Fluent/Helpers/StartupHelper.cs
WalletWasabi.Fluent/Helpers/StartupHelper.cs
@@ -11,12 +11,6 @@ namespace WalletWasabi.Fluent.Helpers
{
private const string KeyPath = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run";
- // Arguments to add Wasabi to macOS startup settings.
- private static readonly string AddCmd = $"osascript -e \' tell application \"System Events\" to make new login item at end with properties {{name:\"{Constants.AppName}\", path:\"/Applications/{Constants.AppName}.app\", hidden:true}} \'";
-
- // Arguments to delete Wasabi from macOS startup settings.
- private static readonly string DeleteCmd = $"osascript -e \' tell application \"System Events\" to delete login item \"{Constants.AppName}\" \'";
-
public static async Task ModifyStartupSettingAsync(bool runOnSystemStartup)
{
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
@@ -34,14 +28,7 @@ namespace WalletWasabi.Fluent.Helpers
}
else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
{
- if (runOnSystemStartup)
- {
- await EnvironmentHelpers.ShellExecAsync(AddCmd).ConfigureAwait(false);
- }
- else
- {
- await EnvironmentHelpers.ShellExecAsync(DeleteCmd).ConfigureAwait(false);
- }
+ await MacOsStartUpHelper.ModifyLoginItemsAsync(runOnSystemStartup);
}
}

Add macOS Helper